Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "anelengqandu"

Question

Hi Guys

I keep on getting this error every time I do an update. "System.InvalidOperationException: Attaching an entity of type 'Synapsis.SmartRentals.RentalContracts.RentalContract' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate." Below is my update code

var property = Mapper.Map<Property>(input);
  await _propertyRepository.UpdateAsync(property);

Hi tried to rename my service from 'abp.services.app.employee' to 'abp.services.app.employeesServices' since its returning a list but now I get an error below;

Unknown provider: abp.services.app.employeeServiceProvider <- abp.services.app.employeeService <- app.views.employees.index

What might be the problem?Or is there a place to where am suppose to remove the original service?

Working Sample code

angular.module('app').controller('app.views.employees.index', [
                 '$scope', '$state', '$uibModal', '$location', '$resource', '$q', '$compile', 'abp.services.app.employee', 'DTOptionsBuilder', 'DTColumnBuilder',
        function ($scope, $state, $modal, $location, $resource, $q, $compile, employeeService, DTOptionsBuilder, DTColumnBuilder) {
            var vm = this;

            vm.employees = [];
          

            function getEmployees() {
                var deferred = $q.defer();

                employeeService.getEmployees({}).success(function (result) {
                    angular.copy(result.items, vm.employees);

                    deferred.resolve(result.items);
                });

                return deferred.promise;
            }
//...

Hi

Have problem with angular service, does not hit my my method on Application side

(function() {
    angular.module('app').controller('app.views.employees.index', [
        '$scope', '$modal', 'abp.services.app.employees',
        function ($scope, $modal, employeeService) {
            var vm = this;

            vm.employees = [];

            function getEmployees() {
                employeeService.getEmployees({}).success(function (result) {
                    vm.employees = result.items;
                });
            }

            vm.openEmployeeCreationModal = function() {
                var modalInstance = $modal.open({
                    templateUrl: '/App/Main/views/employees/createModal.cshtml',
                    controller: 'app.views.employees.createModal as vm',
                    backdrop: 'static'
                });

                modalInstance.result.then(function () {
                    getEmployees();
                });
            };

            getEmployees();
        }
    ]);
})();
public ListResultOutput<EmployeeDto> GetEmployees() {
            var employees = _employeeRepository.GetAll();
            return new ListResultOutput<EmployeeDto> { Items=Mapper.Map<List<EmployeeDto>>(employees)};
        }

What am I missing maybe?

Showing 1 to 3 of 3 entries