public ActionResult DeleteConfirmed(int id) { RegionalCount regionalCount = db.RegionalCount.Find(id); db.RegionalCount.Remove(regionalCount); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Region,RegionTotal,RegionConfirmed,RegionInpatientHospitalization,RegionIcuHospitalization,RegionRecovered,RegionDeath,CovidCountId")] RegionalCount regionalCount) { if (ModelState.IsValid) { db.Entry(regionalCount).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CovidCountId = new SelectList(db.CovidCount, "Id", "Id", regionalCount.CovidCountId); return(View(regionalCount)); }
// GET: RegionalCount/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RegionalCount regionalCount = db.RegionalCount.Find(id); if (regionalCount == null) { return(HttpNotFound()); } return(View(regionalCount)); }
// GET: RegionalCount/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RegionalCount regionalCount = db.RegionalCount.Find(id); if (regionalCount == null) { return(HttpNotFound()); } ViewBag.CovidCountId = new SelectList(db.CovidCount, "Id", "Id", regionalCount.CovidCountId); return(View(regionalCount)); }
public ActionResult Create([Bind(Include = "Id,Region,RegionTotal,RegionConfirmed,RegionInpatientHospitalization,RegionIcuHospitalization,RegionRecovered,RegionDeath,CovidCountId")] RegionalCountViewModel regionalCountVM) { if (ModelState.IsValid) { var regionalCount = new RegionalCount(); var agedate = DateTime.Parse(regionalCountVM.CovidCountId.ToString()); regionalCount.CovidCountId = db.CovidCount.Single(c => c.Day == agedate).Id; regionalCount.Region = regionalCountVM.Region; regionalCount.RegionTotal = regionalCountVM.RegionTotal; regionalCount.RegionConfirmed = regionalCountVM.RegionConfirmed; regionalCount.RegionInpatientHospitalization = regionalCountVM.RegionInpatientHospitalization; regionalCount.RegionIcuHospitalization = regionalCountVM.RegionIcuHospitalization; regionalCount.RegionRecovered = regionalCountVM.RegionRecovered; regionalCount.RegionDeath = regionalCountVM.RegionDeath; db.RegionalCount.Add(regionalCount); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CovidCountId = new SelectList(db.CovidCount, "Id", "Id", regionalCountVM.CovidCountId); return(View(regionalCountVM)); }