public async Task <IList <OperationDTO> > GetAllOperationsByGroupAsync(int groupId) { return(await this.operationRepository.GetAll() .Where(x => x.GroupId == groupId) .Select(x => OperationDTO.FromEntity(x)) .ToListAsync()); }
public async Task <byte[]> GenerateOperationReportAsync(int operationId) { var operation = await this.operationRepository.GetByIdAsync(operationId); var operationDto = OperationDTO.FromEntity(operation); return(Serialize <OperationDTO>(operationDto)); }
public async Task <byte[]> GenerateOperationsReportAsync(ReportRequest request) { var group = await this.groupRepository.GetByIdAsync(request.Id); var operations = group.Operations.Where(x => x.DateOfLoan >= request.StartDate && x.DateOfLoan <= request.EndDate) .Select(x => OperationDTO.FromEntity(x)) .ToList(); return(Serialize <List <OperationDTO> >(operations)); }
public async Task <OperationDTO> GetOperationByIdAsync(int id) { var operation = await this.operationRepository.GetByIdAsync(id); return(OperationDTO.FromEntity(operation)); }
public async Task <IList <OperationDTO> > GetOperationsAsync() { var operations = await this.operationRepository.GetAll().ToListAsync(); return(operations.Select(x => OperationDTO.FromEntity(x)).ToList()); }