public List <RaportEvent> GenerateRaport() { List <RaportEvent> result = new List <RaportEvent>(); foreach (var item in _eventController.Retrieve()) { string employeeName = ""; string gateDescription = ""; Gate gate = _gateRepository.Retrieve(item.GateId); foreach (var employee in _employeeRepository.Retrieve()) { if (item.EmployeeId == employee.EmployeeId) { employeeName = employee.EmployeeName; gateDescription = gate.GateDescription; } } result.Add(new RaportEvent(employeeName, gateDescription, item.EventDate, item.Pass)); } return(result); }
public bool TryPass(int employeeId, int gateId) { Employee employee = _employeeRepository.Retrieve(employeeId); _eventsList.Add(new Event(Guid.NewGuid(), employeeId, gateId, DateTime.Now, employee.HasRights(gateId))); if (employee.HasRights(gateId) == true) { employee.PassTrueEvents.Add(new PassTrueEvent(DateTime.Now)); } return(employee.HasRights(gateId)); }