Ejemplo n.º 1
0
        public ActionResult DisasterReport()
        {
            DisasterReportVM vm = new DisasterReportVM();



            //Set default values for the FROM and TO dates
            vm.DateFrom = new DateTime(2014, 12, 1);
            vm.DateTo   = new DateTime(2014, 12, 31);


            return(View(vm));
        }
Ejemplo n.º 2
0
        public ActionResult DisasterReport(DisasterReportVM vm)
        {
            using (Entities db = new Entities())
            {
                db.Configuration.ProxyCreationEnabled = false;



                0                     List <Disaster> disasters = db.Disasters.ToList();



                TempData["records"] = disasters.ToList();

                return(View(vm));
            }
        }
Ejemplo n.º 3
0
        public ActionResult DisasterReport(DisasterReportVM vm)
        {
            using (Entities db = new Entities())
            {
                db.Configuration.ProxyCreationEnabled = false;


                List <Disaster> disasters = db.Disasters.ToList();

                var list = db.Disasters.Include("City").Include("DisasterType").Where(pp => pp.DisasterDate >= vm.DateFrom && pp.DisasterDate <= vm.DateTo).ToList().Select(rr => new ReportRecord
                {
                    Name         = rr.DisasterType.Name,
                    DisasterDate = rr.DisasterDate.ToString(),
                    DamageLevel  = Convert.ToInt32(rr.DamageLevel),
                    Casualties   = Convert.ToInt32(rr.Casualties),
                    City         = rr.City.Name,
                });


                TempData["records"] = disasters.ToList();

                return(View(vm));
            }
        }