public async Task <ActionResult> CreateUOM(AddUOMViewModel request) { if (!ModelState.IsValid) { Alert($"Invalid Request.", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(UnitOfMeasures), new { id = request.UomTypeId })); } try { var addUOMRequest = new AddUnitOfMeasureRequest { UnitOfMeasureTypeId = request.UomTypeId, Name = request.Name, Description = request.Description, Grammage = request.Grammage, PackSize = request.PackSize, PalletSize = request.PalletSize }; var result = await _unitOfMeasureService.Create(addUOMRequest); if (!result.Success) { Alert($"{result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(UnitOfMeasures), new { id = request.UomTypeId })); } Alert($"Unit Of Measure Created Successfully", NotificationType.success, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(UnitOfMeasures), new { id = request.UomTypeId })); } catch (Exception ex) { Alert($"Error! {ex.Message}.", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(UnitOfMeasures), new { id = request.UomTypeId })); } }
public async Task <IResponseDTO> Create(UnitOfMeasureDto unitOfMeasureDto) { var result = await _unitOfMeasureService.Create(unitOfMeasureDto); return(result); }