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

            return(View(model));
        }
Ejemplo n.º 2
0
 public AdminController()
 {
     context     = new ShopContext();
     CurrentGood = new BusinessGood();
     if (BusinessGoods == null)
     {
         BusinessGoods = new List <BusinessGood>();
         BusinessGood.Autofill(BusinessGoods);
     }
 }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 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"));
 }
Ejemplo n.º 6
0
 public ClientController()
 {
     context       = new ShopContext();
     BusinessGoods = new List <BusinessGood>();
     BusinessGood.Autofill(BusinessGoods);
 }