public StaffServiceFindResponse Find(StaffServiceFindRequest findRequest) { StaffServiceFindResponse result = new StaffServiceFindResponse(); var employee = _db.Where(e => e.FirstName == findRequest.FirstName || e.LastName == findRequest.LastName).FirstOrDefault(); result = this.Get(Int32.Parse(employee.Id.ToString())); return(result); }
public StaffServiceFindResponse Get(int id) { StaffServiceFindResponse result = new StaffServiceFindResponse(); var employee = _db.Where(e => e.Id == id).FirstOrDefault(); result.Employee = employee; var manager = _db.Where(e => e.Id == employee.ManagerId).FirstOrDefault(); result.Manager = manager; var directReports = _db.Where(e => e.ManagerId == employee.Id).ToList(); result.DirectReports = directReports; return(result); }