Exemple #1
0
        public ActionResult Report(int id, DateTime?date)
        {
            var clientEvalHeader = date == null?db.ClientEvalHeaders.AsEnumerable().LastOrDefault(e => e.ClientId == id) :
                                       db.ClientEvalHeaders.SingleOrDefault(e => e.ClientId == id && e.Date == (DateTime)date);

            db.Entry(clientEvalHeader).Collection(e => e.Details).Load();

            foreach (var detail in clientEvalHeader.Details)
            {
                db.Entry(detail).Reference(d => d.Eval).Load();
            }

            var report = new EvalReportViewModel()
            {
                Client         = db.Clients.Find(id),
                ClientEval     = clientEvalHeader,
                EvalCategories = db.EvalCategories.Include(c => c.SubCatogories.Select(s => s.ChildHeaders.Select(h => h.Details)))
            };

            return(View(report));
        }
        public PartialViewResult EvalReport()
        {
            EvalReportViewModel evalReportViewModel = new EvalReportViewModel();

            return(PartialView("EvalReport", evalReportViewModel));
        }