public ActionResult Update(Product product)
        {
            if (ModelState.IsValid)
            {
                _dbContext.Entry(product).State = EntityState.Modified;
                _dbContext.SaveChanges();
            }

            return(Json(product, JsonRequestBehavior.AllowGet));
        }
 public ActionResult AddOrEdit(Employee emp)
 {
     using (MyDBModel db = new MyDBModel())
     {
         if (emp.EmployeeID == 0)
         {
             db.Employee.Add(emp);
             db.SaveChanges();
             return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             db.Entry(emp).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
         }
     }
 }