コード例 #1
0
ファイル: UsersController.cs プロジェクト: Shuvayu/DevBox
        public ActionResult DeleteDC(int id)
        {
            AutoMapper.Mapper.CreateMap <DistributionCenter, DistributionCenterViewModel>();
            var dc = Mapper.Map <DistributionCenterViewModel>(dcContracts.Get(id));

            return(View(dc));
        }
コード例 #2
0
        public ActionResult ValueinTransit()
        {
            AutoMapper.Mapper.CreateMap <Package, PackageViewModel>();
            AutoMapper.Mapper.CreateMap <Medicine, MedicineViewModel>();
            AutoMapper.Mapper.CreateMap <PackageStatus, PackageStatusViewModel>();

            var TransactionPackages = PackagesContracts.PackagesTransactionContracts;
            var grouped             = TransactionPackages.GetAll().Where(x => x.ReceivedOn == null)
                                      .GroupBy(x => new { x.FromLocId, x.ToLocId }).
                                      Select(y => new { FromLocId = y.Key.FromLocId, ToLocId = y.Key.ToLocId, Count = y.Count() });

            var lstValueReport = new List <ValueReportViewModel>();
            ValueReportViewModel         objValueReport = new ValueReportViewModel();
            DistributionCentersContracts objDCName      = new DistributionCentersContracts();
            int totalCount = 0;

            foreach (var o in grouped)
            {
                objValueReport.FromLocation = objDCName.Get(o.FromLocId).Name;
                objValueReport.ToLocation   = objDCName.Get(o.ToLocId).Name;
                objValueReport.Count        = o.Count;
                lstValueReport.Add(objValueReport);
                totalCount = totalCount + o.Count;
            }

            ValueReportViewModel objValueReport1 = new ValueReportViewModel();

            objValueReport1.FromLocation = "";
            objValueReport1.ToLocation   = "Total number of transit packages :";
            objValueReport1.Count        = totalCount;
            lstValueReport.Add(objValueReport1);


            //return View(grouped);
            return(PartialView("_ValueinTransit", lstValueReport));
        }