Exemple #1
0
        public ActionResult Create(storeproduct st)
        {
            try
            {
                db.storeproducts.Add(st);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #2
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                storeproduct storepro = db.storeproducts.Where(x => x.product_ID == id).FirstOrDefault();
                db.storeproducts.Remove(storepro);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #3
0
        public ActionResult Edit(int id, storeproduct storepro)
        {
            try
            {
                db.Entry(storepro).State = EntityState.Modified;
                db.SaveChanges();
                // TODO: Add update logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }