public void Create(ServicePackageDto service) { if (service == null) { throw new ArgumentNullException(nameof(ServicePackageDto)); } repository.Add(new DataLayer.Entities.ServicePackage().InjectFrom(service) as DataLayer.Entities.ServicePackage); unit.Commit(); }
public IActionResult EditServicePackage(ServicePackageViewModel model) { if (ModelState.IsValid) { var service = new ServicePackageDto().InjectFrom(model) as ServicePackageDto; servicePackageService.Update(service); return(RedirectToAction(nameof(ServiceManageController.Index), "ServiceManage")); } return(View()); }
public void Update(ServicePackageDto service) { if (service == null) { throw new ArgumentNullException(nameof(ServicePackageDto)); } var serviceEntity = repository.GetById(service.Id).InjectFrom(service) as DataLayer.Entities.ServicePackage; if (serviceEntity == null) { throw new Exception($"Cannot update service package with id = {service.Id}"); } repository.Update(serviceEntity); unit.Commit(); }