public ViewResult Details(int commodityId) { var getCommodityResult = mc_CommodityRepository.GetCommodity(commodityId); var commodity = getCommodityResult.Result as Commodity; return(View(commodity)); }
public async Task <ActionResult <Commodity> > GetCommodity(int commodityId) { try { var commodity = await mc_CommodityRepository.GetCommodity(commodityId); if (commodity == null) { return(NotFound("Commodity does not exist...")); } return(Ok(commodity)); } catch (Exception exception) { string message = "Error occurred in CommodityController.GetCommodity" + Environment.NewLine; message += exception.Message; return(StatusCode(StatusCodes.Status500InternalServerError, message)); } }