Ejemplo n.º 1
0
        public JsonResult DanhSachDaiLy()
        {
            Request.ContentEncoding  = Encoding.UTF8;
            Response.ContentEncoding = Encoding.UTF8;
            var dsDaiLy   = daiLyService.GetAll();
            var listDaiLy = new List <object>();

            foreach (var dl in dsDaiLy)
            {
                listDaiLy.Add(new
                {
                    label = dl.TenDaiLy,
                    value = dl.Id
                });
            }
            return(Json(listDaiLy, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult CongNoDaiLy(DateTime NgayThongKe)
        {
            var listDaiLy   = daiLyService.GetAll();
            var listDaiLyVm = Mapper.Map <IEnumerable <DaiLy>, IEnumerable <DaiLyViewModel> >(listDaiLy);

            listDaiLyVm.ToList().ForEach(x =>
            {
                var congNoDL   = congNoDLService.GetSingleByIdAndDate(x.Id, NgayThongKe);
                var congNoDLVm = Mapper.Map <CongNoDL, CongNoDLViewModel>(congNoDL);
                if (congNoDLVm != null)
                {
                    x.CongNoDL = congNoDLVm;
                }
                else
                {
                    x.CongNoDL = new CongNoDLViewModel();
                }
            });
            return(View(listDaiLyVm));
        }