public bool DeleteLaptop(int LaptopId) { Laptop Laptop = _laptopRepository.FindById(LaptopId); if (Laptop == null) { return(false); } _laptopRepository.Delete(Laptop); _laptopRepository.SaveChanges(); return(true); }
public bool AssignLaptopToEmployee(int employeeId, int laptopId) { Employee ExistingEmployee = _employeeRepository.FindById(employeeId); Laptop ExistingLaptop = _laptopRepository.FindById(laptopId); if (ExistingEmployee == null || ExistingLaptop == null) { return(false); } ExistingEmployee.LaptopId = laptopId; _employeeRepository.Update(ExistingEmployee); _employeeRepository.SaveChanges(); ExistingLaptop.Employee = ExistingEmployee; _laptopRepository.Update(ExistingLaptop); _laptopRepository.SaveChanges(); return(true); }