Exemplo n.º 1
0
 public void SavePlan(Plan plan)
 {
     if (plan.PlanId == 0)
     {
         context.Plans.Add(plan);
     }
     context.SaveChanges();
 }
Exemplo n.º 2
0
        public ActionResult Edit(Plan plan)
        {
            if (ModelState.IsValid)
            {
                // save the plan
                repository.SavePlan(plan);
                // add a message to the viewbag
                TempData["message"] = string.Format("{0} has been saved", plan.PlanName);

                return RedirectToAction("Index");
            }
            else
            {
                // there is something wrong with the data values
                return View(plan);
            }
        }
Exemplo n.º 3
0
 public void DeletePlan(Plan plan)
 {
     context.Plans.Remove(plan);
     context.SaveChanges();
 }