Exemplo n.º 1
0
 public ActionResult AddMsg(Message msg)
 {
     if (ModelState.IsValid)
     {
         trackerDB.Patients.Find(msg.PatientId).Messages.Add(msg);
         trackerDB.SaveChanges();
         return RedirectToAction("Edit", new { id = msg.PatientId });
     }
     return View(msg);
 }
Exemplo n.º 2
0
 public ActionResult Create(Message message)
 {
     if (ModelState.IsValid)
     {
         //convert usertime to utc before storing - no need for this because of datetimeconversionbinder
         //message.StartDate = TimeZoneInfo.ConvertTimeToUtc(message.StartDate);
         //message.EndDate = TimeZoneInfo.ConvertTimeToUtc(message.EndDate);
         db.Messages.Add(message);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     IEnumerable<SelectListItem> items = db.Patients
         .Select(c => new SelectListItem
         {
             Value = SqlFunctions.StringConvert((decimal)c.PatientId),
             Text = c.FirstName + " " + c.LastName
         });
     ViewBag.PatientId = items;
     return View(message);
 }
Exemplo n.º 3
0
 //****************************Custom Messages****************************
 public ActionResult AddMsg(int pid)
 {
     ViewData["PatientId"] = pid;
     var msg = new Message { StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.AddDays(1) };
     return View(msg);
 }
Exemplo n.º 4
0
 public ActionResult EditMsg(Message msg)
 {
     if (ModelState.IsValid)
     {
         trackerDB.Entry(msg).State = EntityState.Modified;
         trackerDB.SaveChanges();
         return RedirectToAction("Edit", new { id=msg.PatientId});
     }
     return View(msg);
 }