public void UpdateDepartment(DepartmentPocos department) { using (DemoDbEntities db = new DemoDbEntities()) { Department olddepartment = db.Departments.Find(department.Id); olddepartment.Address = department.Address; olddepartment.Description = department.Description; olddepartment.Active = department.active; db.SaveChanges(); } }
public int AddDepartment(DepartmentPocos department) { using (DemoDbEntities db = new DemoDbEntities()) { Department newdepartment = new Department() { Description = department.Description, Address = department.Address, Active = department.active }; db.Departments.Add(newdepartment); db.SaveChanges(); return(newdepartment.Id); } }
public JsonResult EditDepartment(DepartmentPocos department) { _departmentRepository.UpdateDepartment(department); return(Json(Url.Action("DepartmentList", "Department"))); }