コード例 #1
0
        public IHttpActionResult SalesInfoByBranch()
        {
            BranchRepository branchRepository = new BranchRepository();
            var list = branchRepository.AllBranchSales();
            List <BranchSalesViewModel> branchList = new List <BranchSalesViewModel>();

            foreach (SumGroupByModel sgm in list)
            {
                BranchRepository repository = new BranchRepository();

                Branch branchDetails      = repository.Get(sgm.Id);
                BranchSalesViewModel bsvm = new BranchSalesViewModel();

                bsvm.Id               = sgm.Id;
                bsvm.BranchName       = branchDetails.Name;
                bsvm.TotalSalesAmount = sgm.Column1;

                branchList.Add(bsvm);
            }

            return(Ok(branchList));
        }