/// <summary> /// Returns the shipment list of the selected user /// </summary> /// <param name="userId">User Id</param> /// <returns></returns> public IEnumerable <InvoiceDto> GetInvoicesByUserId(string userId) { var mapper = new MapperConfiguration(cfg => cfg.CreateMap <Invoice, InvoiceDto>()).CreateMapper(); List <InvoiceDto> invoiceDtos = new List <InvoiceDto>(); foreach (var invoice in invoicesRepository.GetByUserId(userId)) { InvoiceDto invoiceDto = mapper.Map <InvoiceDto>(invoice); invoiceDto.PostOperatorName = invoicesRepository.GetPostOperatorsIdNames()[invoice.PostOperatorId]; invoiceDtos.Add(invoiceDto); } return(invoiceDtos); }