public ActionResult UpdatePro(product productmodel)
 {
     using (restaurantsdbEntities db = new restaurantsdbEntities())
     {
         if (ModelState.IsValid)
         {
             db.Entry(productmodel).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("GetProducts"));
         }
         else
         {
             productmodel.AddPError = "Couldn't edit Product";
             return(PartialView("_ProEdit", productmodel));
         }
     }
 }
Example #2
0
 public ActionResult UpdateOrd(order ordermodel)
 {
     using (restaurantsdbEntities db = new restaurantsdbEntities())
     {
         if (ModelState.IsValid)
         {
             db.Entry(ordermodel).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("GetOrders"));
         }
         else
         {
             ordermodel.AddOError = "Couldn't edit Order";
             return(PartialView("_OrdEdit", ordermodel));
         }
     }
 }
 public ActionResult UpdateEmp(employee employeemodel)
 {
     using (restaurantsdbEntities db = new restaurantsdbEntities())
     {
         if (ModelState.IsValid)
         {
             db.Entry(employeemodel).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("GetEmployees"));
         }
         else
         {
             employeemodel.AddEError = "Couldn't edit Employee";
             return(PartialView("_EmpEdit", employeemodel));
         }
     }
 }