private void constructAlert(Patient p) { Alert a = new Alert { PatientId = p.PatientId, AlertDate = DateTime.UtcNow, AlertTypeId = 1 // 1 = "missed medication" }; db.Alerts.Add(a); db.SaveChanges(); }
public ActionResult Create(Alert alert) { if (ModelState.IsValid) { alert.Patient.RegisteredBy = User.Identity.Name; db.Alerts.Add(alert); db.SaveChanges(); return RedirectToAction("Index"); } return View(alert); }
public ActionResult Edit(Alert alert) { if (ModelState.IsValid) { alert.Patient.RegisteredBy = User.Identity.Name; db.Entry(alert).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(alert); }