コード例 #1
0
        public ViewResult Index()
        {
            var getCommoditiesResult = mc_CommodityRepository.GetCommodities("");
            var commodities          = getCommoditiesResult.Result as List <Commodity>;

            var retCommodityGroupsResult = mc_CommodityRepository.GetCommodityGroups("");
            var commodityGroups          = retCommodityGroupsResult.Result as List <CommodityGroup>;

            var commodityViewModels     = BuildCommodityViewModels(commodityGroups, commodities) as List <CommodityViewModel>;
            var commodityIndexViewModel = new CommodityIndexViewModel(commodityViewModels, commodityGroups);

            return(View(commodityIndexViewModel));
        }
コード例 #2
0
        public async Task <ActionResult <List <CommodityGroup> > > GetCommodityGroups()
        {
            try
            {
                IEnumerable <CommodityGroup> commodityGroups = await mc_CommodityRepository.GetCommodityGroups(string.Empty);

                return(Ok(commodityGroups));
            }
            catch (Exception exception)
            {
                string message = "Error occurred in CommodityController.GetCommodityGroups." + Environment.NewLine;
                message += exception.Message;
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
コード例 #3
0
        public ViewResult Index()
        {
            var commodityGroupIndexViewModel = new CommodityGroupIndexViewModel();

            var getCommodityGroupsResult = mc_CommodityRepository.GetCommodityGroups("");

            commodityGroupIndexViewModel.CommodityGroups = getCommodityGroupsResult.Result as List <CommodityGroup>;

            return(View(commodityGroupIndexViewModel));
        }