Exemplo n.º 1
0
        public ActionResult DetailView(detailsearchmodel model1)
        {
            List <int>      i     = JsonConvert.DeserializeObject <List <int> >(model1.Cat);
            LessonPlanModel model = new LessonPlanModel();

            if (model1.from != null)
            {
                var      a       = model1.from.Replace("-", "/");
                DateTime from    = Convert.ToDateTime(a);
                var      catlist = unitOfWork.LessonPlanCategoryRepository.Get();
                var      list    =
                    (from t in catlist
                     join q in i
                     on t.Id equals q
                     select t
                    ).ToList();
                model.LessonPlanDetailList = list.Select(x => new LessonPlanDetailModel()
                {
                    CategoryId = x.Id, Category = x.Name, Id = x.Id, Sunday = from.ToShortDateString(), Monday = from.AddDays(1).ToShortDateString(), Tuesday = from.AddDays(2).ToShortDateString(), Wednesday = from.AddDays(3).ToShortDateString(), Thursday = from.AddDays(4).ToShortDateString()
                }).ToList();
                ViewBag.count = model.LessonPlanDetailList.Count - 1;
            }
            else
            {
                model.LessonPlanDetailList = unitOfWork.LessonPlanCategoryRepository.Get().Select(x => new LessonPlanDetailModel()
                {
                    Category = x.Name, Id = x.Id
                }).ToList();
            }
            return(PartialView(model));
        }
Exemplo n.º 2
0
        public ActionResult DetailView(detailsearchmodel data)
        {
            LessonPlanModel model  = new LessonPlanModel();
            var             a      = data.from.Replace("-", "/");
            DateTime        from   = Convert.ToDateTime(a);
            DateTime        to     = from.AddDays(4);
            var             result = mapping.ToList(unitOfWork.LessonsPlanMasterRepository.Get((x => x.IsActive == false && x.ClassId == data.clas && x.SubjectId == data.subject && x.CreatedFor >= from && x.CreatedFor <= to)));

            model.LessonsPlanMasterModelList = result;
            ViewBag.count = model.LessonsPlanMasterModelList.Count;
            return(PartialView(model));
        }