public ActionResult EditGroup(DiscountGroupModel model) { if (!ModelState.IsValid) { return(View("EditGroup", model)); } else { using (DiscountContext context = new DiscountContext()) { context.Edit(model); context.SetGroupItems(model.DiscountGroupId, model.DiscountList.Trim(',')); } return(RedirectToAction("Groups")); } }
public ActionResult Edit(DiscountModel model) { if (!ModelState.IsValid) { using (DiscountContext context = new DiscountContext()) { ViewBag.DiscountKinds = context.GetDiscountKinds(); } return(View("Edit", model)); } else { using (DiscountContext context = new DiscountContext()) { context.Edit(model); } return(RedirectToAction("Index")); } }