Warehouses #1
@@ -6,7 +6,7 @@ public class ProductDto : DtoBase
|
|||||||
public int RecipientID { get; set; }
|
public int RecipientID { get; set; }
|
||||||
public string RecipientIdx { get; set; }
|
public string RecipientIdx { get; set; }
|
||||||
public string FaIdx { get; set; }
|
public string FaIdx { get; set; }
|
||||||
public string RecipientName => Recipient.RecipientDesc;
|
public string RecipientName { get; set; }
|
||||||
|
|
||||||
public RecipientDto Recipient { get; set; }
|
public RecipientDto Recipient { get; set; }
|
||||||
}
|
}
|
||||||
@@ -20,9 +20,24 @@ public class ProductService : ServiceBase<ProductDto>, IProductService
|
|||||||
|
|
||||||
public async Task<IEnumerable<ProductDto?>> GetEntitiesToFix(string indexName)
|
public async Task<IEnumerable<ProductDto?>> GetEntitiesToFix(string indexName)
|
||||||
{
|
{
|
||||||
|
IList<RecipientDto> recipients =
|
||||||
|
(await Context.Recipients.ToListAsync()).Select(x => Mapper.Map<RecipientDto>(x)).ToList();
|
||||||
IList<ProductDto> products = (await GetAll()).ToList();
|
IList<ProductDto> products = (await GetAll()).ToList();
|
||||||
|
|
||||||
return products.Where(x => x?.FaIdx == indexName);
|
IEnumerable<ProductDto> productDtos = products.Where(x => x?.FaIdx == indexName);
|
||||||
|
|
||||||
|
foreach (ProductDto productDto in productDtos)
|
||||||
|
{
|
||||||
|
RecipientDto? recipient = recipients.FirstOrDefault(x => x.ID == productDto.RecipientID);
|
||||||
|
|
||||||
|
if (recipient != null)
|
||||||
|
{
|
||||||
|
productDto.Recipient = recipient;
|
||||||
|
productDto.RecipientName = recipient.RecipientDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return productDtos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateEntity(ProductDto entity)
|
public async Task UpdateEntity(ProductDto entity)
|
||||||
|
|||||||
Reference in New Issue
Block a user