public ActionResult EditUnitOfMeasure(UnitOfMeasure dvm) { //if (!_permissionSvc.TryCheckAccess(StandardPermissionProvider.ManageDepartment, CurrentUser)) //{ // return AccessDeniedView(); //} var dept = _unitOfMeasureService.Find(dvm.Id); if (dept == null) { ErrorNotification("Category could not be found or has been deleted"); return(RedirectToAction("Department")); } if (ModelState.IsValid) { dept.Symbol = dvm.Symbol; dept.Name = dvm.Name; dept.Decimals = dvm.Decimals; _unitOfMeasureService.Update(dept); SuccessNotification("Category updated Successfully"); return(RedirectToAction("Category")); } return(View()); }
public async Task <ActionResult> EditUOM(Guid id, EditUOMViewModel request) { if (!ModelState.IsValid) { Alert("Invalid Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } if (!id.Equals(request.Id)) { Alert("Invalid Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } try { var uomEditRequest = new UpdateUnitOfMeasureRequest { Id = request.Id, Name = request.Name, Description = request.Description, UnitOfMeasureTypeId = request.UOMTypeId, Grammage = request.Grammage, PackSize = request.PackSize, PalletSize = request.PalletSize }; var result = await _unitOfMeasureService.Update(id, uomEditRequest); if (!result.Success) { Alert($"Error: {result.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } Alert($"Unit Of Measure Updated Successfully", NotificationType.success, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(UnitOfMeasures), new { id = request.UOMTypeId })); } catch { Alert($"Error Occurred While processing the request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } }
public async Task <IResponseDTO> Update(UnitOfMeasureDto unitOfMeasureDto) { var result = await _unitOfMeasureService.Update(unitOfMeasureDto); return(result); }