public ViewResult Delete(int commodityId) { var commoditySaveViewModel = new CommoditySaveViewModel(); var commodityUndoResult = mc_CommodityRepository.DeleteCommodity(commodityId); commoditySaveViewModel.Commodity = commodityUndoResult.Result as Commodity; var commodityGroupsResult = mc_CommodityRepository.GetCommodityGroups(""); commoditySaveViewModel.CommodityGroups = commodityGroupsResult.Result as List <CommodityGroup>; return(View("Save", commoditySaveViewModel)); }
public async Task <ActionResult <Commodity> > DeleteCommodity(int commodityId) { try { var commodityUndo = await mc_CommodityRepository.DeleteCommodity(commodityId); if (commodityUndo == null) { return(NotFound()); } return(Ok(commodityUndo)); } catch (Exception exception) { var message = "Error occured in CommodityController.DeleteCommodity" + Environment.NewLine; message += exception.Message; return(StatusCode(StatusCodes.Status500InternalServerError, message)); } }