Example #1
0
        public ActionResult Create(ProductModals modal)
        {
            int id = process.Save(modal);

            if (id > 0)
            {
                return(RedirectToAction("Index"));
            }
            return(PartialView());
        }
Example #2
0
 public bool Edit(int id, ProductModals models)
 {
     using (var contest = new PrkStoreEntities())
     {
         var employee = contest.tblProduct.FirstOrDefault(x => x.Id == id);// first or default use garda fast hucha where vanda
         if (employee != null)
         {
             employee.Name        = models.Name;
             employee.Description = models.Description;
             employee.Price       = models.Price;
         }
         contest.SaveChanges();
         return(true);
     }
 }
Example #3
0
 public int Save(ProductModals modal)
 {
     using (var database = new PrkStoreEntities())
     {
         tblProduct CategoryTB = new tblProduct()
         {
             Name        = modal.Name,
             Description = modal.Description,
             Price       = modal.Price
         };
         database.tblProduct.Add(CategoryTB);
         database.SaveChanges();
         return(CategoryTB.Id);
     }
 }
Example #4
0
        public ActionResult Edit(int id, ProductModals modal)
        {
            var result = process.Edit(id, modal);

            return(RedirectToAction("Index"));
        }