public ActionResult Add(BusinessGood a) { if (ModelState.IsValid) { BusinessGoods.Add(a); BusinessGood.AddOrUpdate(a); return(RedirectToAction("Index" /*,new { id = (int)Session["page"]}*/)); } else { return(View(a)); } }
public ActionResult Edit(BusinessGood a) { if (ModelState.IsValid) { int index = BusinessGoods .IndexOf(BusinessGoods.FirstOrDefault(x => x.GoodId == a.GoodId)); BusinessGoods[index] = a; BusinessGood.AddOrUpdate(a); return(RedirectToAction("Index" /*,new { id = (int)Session["page"]}*/)); } else { return(View(a)); } }