Exemplo n.º 1
0
        public ViewResult Details(int commodityId)
        {
            var getCommodityResult = mc_CommodityRepository.GetCommodity(commodityId);
            var commodity          = getCommodityResult.Result as Commodity;

            return(View(commodity));
        }
Exemplo n.º 2
0
        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));
            }
        }