コード例 #1
0
        public JsonResult Edit(Employee employee)
        {
            CrudOpDbContext db = new CrudOpDbContext();

            db.Entry(employee).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(Json(employee, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult Delete(int ID)
        {
            CrudOpDbContext db       = new CrudOpDbContext();
            Employee        employee = new Employee();

            employee = db.Employees.Find(ID);
            db.Entry(employee).State = System.Data.Entity.EntityState.Deleted;
            db.SaveChanges();
            return(Json(employee, JsonRequestBehavior.AllowGet));
        }