Ejemplo n.º 1
0
 //
 // GET: /CCard/
 public ActionResult Index()
 {
     List<CCardModel> model = null;
     using (CCardContext context = new CCardContext())
     {
         model = context.GetCards();
     }
     return View(model);
 }
Ejemplo n.º 2
0
 //
 // GET: /CCard/Edit/Id
 public ActionResult Edit(int id = 0)
 {
     CCardModel model = null;
     using (CCardContext context = new CCardContext())
     {
         model = context.GetCard(id);
     }
     using (DiscountContext context = new DiscountContext())
     {
         ViewBag.DiscountGroups = context.GetGroupList();
     }
     return View("Edit", model);
 }
Ejemplo n.º 3
0
 public ActionResult Edit(CCardModel model)
 {
     if (!ModelState.IsValid)
     {
         using (DiscountContext context = new DiscountContext())
         {
             ViewBag.DiscountGroups = context.GetGroupList();
         }
         return View("Edit", model);
     }
     else
     {
         using (CCardContext context = new CCardContext())
         {
             context.Edit(model);
         }
         return RedirectToAction("Index");
     }
 }