public ActionResult DeleteConfirmed(int id) { AgeGroupCount ageGroupCount = db.AgeGroupCount.Find(id); db.AgeGroupCount.Remove(ageGroupCount); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,StartAge,EndAge,AgeCount,CovidCountId")] AgeGroupCount ageGroupCount) { if (ModelState.IsValid) { db.Entry(ageGroupCount).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CovidCountId = new SelectList(db.CovidCount, "Id", "Id", ageGroupCount.CovidCountId); return(View(ageGroupCount)); }
// GET: AgeGroupCount/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AgeGroupCount ageGroupCount = db.AgeGroupCount.Find(id); if (ageGroupCount == null) { return(HttpNotFound()); } return(View(ageGroupCount)); }
// GET: AgeGroupCount/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AgeGroupCount ageGroupCount = db.AgeGroupCount.Find(id); if (ageGroupCount == null) { return(HttpNotFound()); } ViewBag.CovidCountId = new SelectList(db.CovidCount, "Id", "Id", ageGroupCount.CovidCountId); return(View(ageGroupCount)); }
public ActionResult Create([Bind(Include = "Id,StartAge,EndAge,AgeCount,CovidCountId")] AgeGroupViewModel ageGroupCountVM) { if (ModelState.IsValid) { var ageGroupCount = new AgeGroupCount(); var agedate = DateTime.Parse(ageGroupCountVM.CovidCountId.ToString()); ageGroupCount.CovidCountId = db.CovidCount.Single(c => c.Day == agedate).Id; ageGroupCount.AgeCount = ageGroupCountVM.AgeCount; ageGroupCount.StartAge = ageGroupCountVM.StartAge; ageGroupCount.EndAge = ageGroupCountVM.EndAge; ageGroupCount.AgeCount = ageGroupCountVM.AgeCount; db.AgeGroupCount.Add(ageGroupCount); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CovidCountId = new SelectList(db.CovidCount, "Id", "Id", ageGroupCountVM.CovidCountId); return(View(ageGroupCountVM)); }