Example #1
0
        public ActionResult Edit(int id = 1)
        {
            CurrentGood = BusinessGoods.FirstOrDefault(x => x.GoodId == id);
            var model = CurrentGood;

            return(View(model));
        }
Example #2
0
 public AdminController()
 {
     context     = new ShopContext();
     CurrentGood = new BusinessGood();
     if (BusinessGoods == null)
     {
         BusinessGoods = new List <BusinessGood>();
         BusinessGood.Autofill(BusinessGoods);
     }
 }
Example #3
0
 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));
     }
 }
Example #4
0
 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));
     }
 }
Example #5
0
 public ActionResult Remove(int id)
 {
     BusinessGood.Remove(BusinessGoods.FirstOrDefault(x => x.GoodId == id));
     BusinessGoods.Remove(BusinessGoods.FirstOrDefault(x => x.GoodId == id));
     return(RedirectToAction("GetTableGoods"));
 }
Example #6
0
 public ClientController()
 {
     context       = new ShopContext();
     BusinessGoods = new List <BusinessGood>();
     BusinessGood.Autofill(BusinessGoods);
 }