public ActionResult TreatmentPlan() { // TODO: Retrieve treatment plan from database // Dummy username in there to make this work for now TreatmentPlan plan = new TreatmentPlan { Username = "******" }; TreatmentPlanViewModel model = new TreatmentPlanViewModel { Plan = plan }; return View(model); }
public ActionResult TreatmentPlan(TreatmentPlanViewModel model) { if (ModelState.IsValid) { // TODO: Create/Update treatment plan in DB Response.Cookies.Add(new HttpCookie("Eye", model.Plan.WeakEye.ToString())); if (model.Plan.Glasses) { Response.Cookies.Add(new HttpCookie("Glasses", model.Plan.Glasses.ToString())); } else { Response.Cookies.Remove("Glasses"); } return RedirectToAction("Index", "Home"); } return View(model); }