Base solution for your next web application

Activities of "prahlad"

I tried to create a list page similar to the example in the sample like get Tasks, I did exactly similar way with different entity, not sure my dynamic web api service is not invoking from my js file. Here is the sample code. Not sure where I am going wrong. My Html file is loading with lists empty, do we need to have an y other settings apart from inheriting from IApplicationService? Please suggest me where I am missing, it is wasting time and making me feel wrong about this framework, this is an excellent framework which I liked the idea very well.

Js File

(function () { var app = angular.module('app');

var controllerId = 'sts.views.jobLocation.locationsList';
//var controllerId = 'locationsController';
app.controller(controllerId, [
     '$scope', '$location', 'abp.services.tasksystem.jobLocation',
     function ($scope, $location, jobLocationService) {
        var vm = this;

        //vm.localize = abp.localization.getSource('SimpleTaskSystem');

        vm.jobLocationList = [];

        $scope.selectedState = 0;
        
        vm.filter1 = "test";

        //$scope.$watch('selectedState', function (value) {
        //    vm.refreshJobLocations();
        //});

       // alert("I am here1");
        vm.refreshJobLocations();

        vm.refreshJobLocations = function () {
            abp.ui.setBusy( //Set whole page busy until getTasks complete
                null,
                jobLocationService.getLocs({}).success(function (data) {
                    vm.jobLocationList = data.jobLocationsList;
                })
            );
        };

        
        vm.getLocationsCountText = function () {
            return abp.utils.formatString(vm.localize('Xlocations'), vm.jobLocationList.length);
        };
    }
]);

})();

Cshtml <div class="panel panel-default" ng-controller="sts.views.jobLocation.locationsList as vm">

&lt;br /&gt;&lt;br /&gt;
&lt;div class=&quot;panel-heading&quot; style=&quot;position: relative;&quot;&gt;
    &lt;br /&gt;
    &lt;div class=&quot;row&quot;&gt;
        
        &lt;h3 class=&quot;panel-title col-xs-6&quot;&gt;
            TYest
        &lt;/h3&gt;


    &lt;/div&gt;
&lt;/div&gt;

&lt;ul class=&quot;list-group&quot; ng-repeat=&quot;jobloc in vm.jobLocationList&quot;&gt;
    &lt;div class=&quot;list-group-item&quot;&gt;
        &lt;span&gt;{{jobloc.JobLocationID}}&lt;/span&gt;
        &lt;span&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;
        &lt;span&gt;{{jobloc.JobLocationName}}&lt;/span&gt;
    &lt;/div&gt;
&lt;/ul&gt;

</div>

-- Webapi service using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Abp.AutoMapper; using Abp.Application.Services; using Abp.Domain.Repositories; using SimpleTaskSystem.JobLocations.Dtos; using SimpleTaskSystem.JobLocations; using AutoMapper;

namespace SimpleTaskSystem.JobLocations { public class JobLocationAppService : ApplicationService,IJobLocationAppService {

    private readonly IRepository&lt;JobLocation&gt; _jobLocationRepository;


    public JobLocationAppService(IRepository&lt;JobLocation&gt; jobLocationRepository)
    {
        _jobLocationRepository = jobLocationRepository;
    }

    //public JobLocationAppService()
    //{
    //    //_jobLocationRepository = new IJobLocationRepository();
    //}

    /*
    private readonly IJobLocationRepository _jobLocationRepository;

    public JobLocationAppService(IJobLocationRepository jobLocationRepository)
    {
        _jobLocationRepository = jobLocationRepository;
    }
    */
    

    public void CreateJobLocation(JobLocationDto jobLocationDTO)
    {
        Logger.Info("Creating a JobLocation for input: " + jobLocationDTO);

        //if (null == jobLocationDTO)
        //    jobLocationDTO = new JobLocationDto();

        JobLocation jobLocation = new JobLocation {
            JobLocationID = jobLocationDTO.JobLocationID,
            JobLocationName = jobLocationDTO.JobLocationName,
            CreatedAt = DateTime.Now,
            CreatedBy = "PrahladTest"
        };

        _jobLocationRepository.Insert(jobLocation);
    }

    public GetJobLocationsOutput GetLocs(GetJobLocationInput input)
    {
        Logger.Info("GetJobLocations for filter " );

        List&lt;JobLocationDto&gt; jobLocationDtos = new List&lt;JobLocationDto&gt;();

        List&lt;JobLocation&gt; jobLocationsList = _jobLocationRepository.GetAll().ToList();

        jobLocationDtos = Mapper.Map&lt;List&lt;JobLocationDto&gt;>(jobLocationsList);


        return new GetJobLocationsOutput
        {
            JobLocationsList  = Mapper.Map&lt;List&lt;JobLocationDto&gt;>(jobLocationsList)
        };
        
    }
}

}

Hi I really liked ASP.NET boiler plate framework, hats off to the framework. I am getting errors when I am using basic thing, please suggest me where I am going wrong. Thanks in advance.

After adding new entity to existing project, did made use of PM> Add-Migration "XXXX" and PM> Update-Database commands.

It successfully created table in the database whatever I specified in entity. I did add in DBContext also. But issue is when I want to use default repository for this, my Repository is null.

Here is my sample code, I made use of existing sample application added a new entity called JobLocation. When I am using while creating new JobLocation getting null in the repository.

Added in DBContext like below public class SimpleTaskSystemDbContext : AbpDbContext { public virtual IDbSet<Task> Tasks { get; set; }

    public virtual IDbSet&lt;Person&gt; People { get; set; }

    public virtual IDbSet&lt;JobLocation&gt; JobLocs { get; set; }

    public SimpleTaskSystemDbContext()
        : base("Default")
    {

    }

    public SimpleTaskSystemDbContext(string nameOrConnectionString)
        : base(nameOrConnectionString)
    {
        
    }

    //This constructor is used in tests
    public SimpleTaskSystemDbContext(DbConnection connection)
        : base(connection, true)
    {

    }

}

public virtual IDbSet<JobLocation> JobLocs { get; set; }

Showing 1 to 2 of 2 entries