public async Task <ActionResult> DeleteUOM(Guid id, UOMDetailsViewModel request) { if (!ModelState.IsValid) { Alert("Bad Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(UnitOfMeasures), new { id = request.UOMTypeId })); } if (id == null) { Alert($"Invalid Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(UnitOfMeasures), new { id = request.UOMTypeId })); } try { var result = await _unitOfMeasureService.Delete(id); if (!result.Success) { Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(UnitOfMeasures), new { id = request.UOMTypeId })); } Alert($"Unit Of Measure Type Deleted 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(RedirectToAction(nameof(UnitOfMeasures), new { id = request.UOMTypeId })); } }
public string DeleteUnitOfMeasure(int unitId) { return(_iUnitOfMeasureService.Delete(unitId)); }
public async Task <IResponseDTO> Delete(int measureId) { _response = await _unitOfMeasureService.Delete(measureId); return(_response); }