public async Task <IActionResult> Add(SalesEmployeeModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new DataSourceResult {
                    Errors = ModelState.SerializeErrors()
                }));
            }

            var salesEmployee = new SalesEmployee();

            salesEmployee = model.ToEntity(salesEmployee);
            await _salesEmployeeService.InsertSalesEmployee(salesEmployee);

            return(new NullJsonResult());
        }
        public async Task <IActionResult> Update(SalesEmployeeModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new DataSourceResult {
                    Errors = ModelState.SerializeErrors()
                }));
            }

            var salesemployee = await _salesEmployeeService.GetSalesEmployeeById(model.Id);

            salesemployee = model.ToEntity(salesemployee);
            await _salesEmployeeService.UpdateSalesEmployee(salesemployee);

            return(new NullJsonResult());
        }
        public async Task <IActionResult> Add(SalesEmployeeModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new DataSourceResult {
                    Errors = ModelState.SerializeErrors()
                }));
            }

            var salesEmployee = new SalesEmployee();

            salesEmployee = model.ToEntity(salesEmployee);
            await _salesEmployeeService.InsertSalesEmployee(salesEmployee);

            //activity log
            await _customerActivityService.InsertActivity("AddNewSalesEmployee", salesEmployee.Id, _localizationService.GetResource("ActivityLog.AddNewSalesEmployee"),
                                                          salesEmployee.Name);

            return(new NullJsonResult());
        }
Beispiel #4
0
        public async Task <IActionResult> Update(SalesEmployeeModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new DataSourceResult {
                    Errors = ModelState.SerializeErrors()
                }));
            }

            var salesemployee = await _salesEmployeeService.GetSalesEmployeeById(model.Id);

            salesemployee = model.ToEntity(salesemployee);
            await _salesEmployeeService.UpdateSalesEmployee(salesemployee);

            //activity log
            await _customerActivityService.InsertActivity("EditSalesEmployee", salesemployee.Id, _translationService.GetResource("ActivityLog.EditSalesEmployee"),
                                                          salesemployee.Name);

            return(new JsonResult(""));
        }
Beispiel #5
0
 public static SalesEmployee ToEntity(this SalesEmployeeModel model, SalesEmployee destination)
 {
     return(model.MapTo(destination));
 }
Beispiel #6
0
 public static SalesEmployee ToEntity(this SalesEmployeeModel model)
 {
     return(model.MapTo <SalesEmployeeModel, SalesEmployee>());
 }