Esempio n. 1
0
 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();
     }
 }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
 public JsonResult EditDepartment(DepartmentPocos department)
 {
     _departmentRepository.UpdateDepartment(department);
     return(Json(Url.Action("DepartmentList", "Department")));
 }