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); }
public Laptop CreateLaptop(Laptop Laptop) { _laptopRepository.Create(Laptop); _laptopRepository.SaveChanges(); return(Laptop); }