public async Task Update(BusinessActionViewModel businessVm) { var currentBusiness = await _repository.FindById(businessVm.Id); currentBusiness.Name = businessVm.Name; currentBusiness.Description = businessVm.Description; await _repository.Update(currentBusiness); _unitOfWork.Commit(); }
public IActionResult SaveEntity(BusinessActionViewModel businessVm) { if (!ModelState.IsValid) { IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors); return(new BadRequestObjectResult(allErrors)); } if (businessVm.Id == null) { //await _businessService.AddAsync(businessVm); } else { _actionService.Update(businessVm); } return(new OkObjectResult(businessVm)); }
public async Task <IActionResult> SaveEntity(BusinessActionViewModel businessVm) { if (!ModelState.IsValid) { IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors); return(new BadRequestObjectResult(allErrors)); } if (businessVm.Id > 0) { await _actionService.Update(businessVm); } else { await _actionService.Update(businessVm); } return(new OkObjectResult(businessVm)); }