public void AssignRoomToDepartment(Department department, Room room) { if (department == null) throw new ArgumentNullException("department"); if (room == null) throw new ArgumentNullException("room"); var departmentService = new DepartmentService(Context); departmentService.AssignRoom(department, room); }
public void AssignRoomToDepartment(string departmentName, string roomName) { if (string.IsNullOrEmpty(departmentName)) throw new ArgumentNullException("department"); if (string.IsNullOrEmpty(roomName)) throw new ArgumentNullException("roomName"); var departmentService = new DepartmentService(Context); departmentService.AssignRoom(departmentName, roomName); }
public ActionResult Create(DepartmentsViewModel model) { if (!ModelState.IsValid) { model.Departments = Context.Departments.OrderBy(x => x.Name).ToList(); return View("List", model); } var departmentService = new DepartmentService(Context); departmentService.Create(model.NewDepartmentName); return RedirectToAction("List"); }
public ActionResult Delete(Guid id) { var department = Context.Departments.FirstOrDefault(x => x.Id == id); if (department == null) { return HttpNotFound(); } if (department.Rooms.Any()) { return HttpNotFound(); } var departmentService = new DepartmentService(Context); departmentService.Delete(department); return RedirectToAction("List"); }