Exemple #1
0
 public ActionResult Add(Clitzy.Models.MemberShip memberShip)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ocmde.MemberShips.Add(memberShip);
             ocmde.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View("Add", memberShip));
     }
     catch (Exception e)
     {
         return(View("Error", new HandleErrorInfo(e, "MemberShip", "Add")));
     }
 }
Exemple #2
0
 public ActionResult Edit(Clitzy.Models.MemberShip memberShip)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var currentMemberShip = ocmde.MemberShips.Find(memberShip.Id
                                                            );
             currentMemberShip.Name        = memberShip.Name;
             currentMemberShip.Price       = memberShip.Price;
             currentMemberShip.Status      = memberShip.Status;
             currentMemberShip.Description = memberShip.Description;
             currentMemberShip.Month       = memberShip.Month;
             ocmde.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View("Edit", memberShip));
     }
     catch (Exception e)
     {
         return(View("Error", new HandleErrorInfo(e, "MemberShip", "Edit")));
     }
 }