public async Task <IActionResult> PutRole(byte id, Role role) { if (id != role.Id) { return(BadRequest()); } _context.Entry(role).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoleExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCategory([FromRoute] int id, [FromBody] Category category) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != category.Id) { return(BadRequest()); } _context.Entry(category).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public override async Task <TaskerTask> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var taskerTask = await RepositoryDbSet.FindAsync(id); if (taskerTask != null) { await RepositoryDbContext.Entry(taskerTask) .Reference(c => c.TaskName) .LoadAsync(); await RepositoryDbContext.Entry(taskerTask) .Reference(c => c.Description) .LoadAsync(); await RepositoryDbContext.Entry(taskerTask.TaskName) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(taskerTask.Description) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } return(TaskerTaskMapper.MapFromDomain(taskerTask)); }
public override async Task <DAL.App.DTO.ProductService> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var productService = await RepositoryDbSet.FindAsync(id); if (productService != null) { await RepositoryDbContext.Entry(productService) .Reference(c => c.ProductForClient) .LoadAsync(); await RepositoryDbContext.Entry(productService) .Reference(c => c.WorkObject) .LoadAsync(); await RepositoryDbContext.Entry(productService) .Reference(c => c.Description) .LoadAsync(); await RepositoryDbContext.Entry(productService.Description) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } return(ProductServiceMapper.MapFromDomain(productService)); }
public override async Task <DAL.App.DTO.AppUserInPosition> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var workerInPosition = await RepositoryDbSet.FindAsync(id); if (workerInPosition != null) { await RepositoryDbContext.Entry(workerInPosition) .Reference(c => c.AppUserPosition) .LoadAsync(); await RepositoryDbContext.Entry(workerInPosition.AppUserPosition) .Reference(c => c.AppUserPositionValue) .LoadAsync(); await RepositoryDbContext.Entry(workerInPosition.AppUserPosition.AppUserPositionValue) .Collection(c => c.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(workerInPosition) .Reference(c => c.AppUser) .LoadAsync(); } return(AppUserInPositionMapper.MapFromDomain(workerInPosition)); }
public override async Task <DAL.App.DTO.ClientGroup> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var clientGroup = await RepositoryDbSet.FindAsync(id); if (clientGroup != null) { await RepositoryDbContext.Entry(clientGroup) .Collection(c => c.Clients) .LoadAsync(); await RepositoryDbContext.Entry(clientGroup) .Reference(c => c.Name) .LoadAsync(); await RepositoryDbContext.Entry(clientGroup.Name) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(clientGroup) .Reference(c => c.Description) .LoadAsync(); await RepositoryDbContext.Entry(clientGroup.Description) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } return(ClientGroupMapper.MapFromDomain(clientGroup)); }
public override async Task <DTO.Dog> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var dog = await RepositoryDbSet.FindAsync(id); if (dog != null) { await RepositoryDbContext.Entry(dog) .Reference(c => c.Sex) .LoadAsync(); await RepositoryDbContext.Entry(dog.Sex) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(dog) .Reference(c => c.Breed) .LoadAsync(); await RepositoryDbContext.Entry(dog.Breed) .Reference(c => c.BreedName) .LoadAsync(); await RepositoryDbContext.Entry(dog.Breed.BreedName) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } return(DogMapper.MapFromDomain(dog)); }
public override async Task <DAL.App.DTO.Payment> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var payment = await RepositoryDbSet.FindAsync(id); if (payment != null) { await RepositoryDbContext.Entry(payment) .Reference(c => c.PaymentMethod) .LoadAsync(); await RepositoryDbContext.Entry(payment.PaymentMethod) .Reference(c => c.PaymentMethodValue) .LoadAsync(); await RepositoryDbContext.Entry(payment.PaymentMethod.PaymentMethodValue) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } return(PaymentMapper.MapFromDomain(payment)); }
public override async Task <DAL.App.DTO.BillLine> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var billLine = await RepositoryDbSet.FindAsync(id); if (billLine != null) { await RepositoryDbContext.Entry(billLine) .Reference(c => c.Bill) .LoadAsync(); await RepositoryDbContext.Entry(billLine.Bill) .Reference(c => c.Comment) .LoadAsync(); await RepositoryDbContext.Entry(billLine.Bill.Comment) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(billLine) .Reference(c => c.Product) .LoadAsync(); await RepositoryDbContext.Entry(billLine.Product) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } return(BillLineMapper.MapFromDomain(billLine)); }
public override async Task <DAL.App.DTO.AppUserOnObject> FindAsync(params object[] id) { var appUserOnObject = await RepositoryDbSet.FindAsync(id); if (appUserOnObject != null) { await RepositoryDbContext.Entry(appUserOnObject) .Reference(c => c.AppUser).LoadAsync(); } return(AppUserOnObjectMapper.MapFromDomain(appUserOnObject)); }
public async Task <Product> FindProductInfoAsync(int id) { var product = await RepositoryDbContext.Set <Domain.Product>().FindAsync(id); RepositoryDbContext.Entry(product).State = EntityState.Detached; return(ProductMapper.MapFromDomain(await RepositoryDbSet.AsNoTracking().Where(a => a.Id == product.Id) .Include(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(s => s.Shop) .Include(m => m.Manufacturer) .FirstOrDefaultAsync())); }
public RepositoryActionResult <Account> UpdateAccount(Account accountToUpdate) { try { // you can only update when an expensegroup already exists for this id var existingAcc = _context.Accounts.FirstOrDefault(a => a.AccountId == accountToUpdate.AccountId); if (existingAcc == null) { return(new RepositoryActionResult <Account>(accountToUpdate, RepositoryActionStatus.NotFound)); } // change the original entity status to detached; otherwise, we get an error on attach // as the entity is already in the dbSet // set orginal entity state to detached _context.Entry(existingAcc).State = EntityState.Detached; // attach & save _context.Accounts.Attach(accountToUpdate); // set the updated entity state to modified, so it gets updated. _context.Entry(accountToUpdate).State = EntityState.Modified; var result = _context.SaveChanges(); if (result > 0) { return(new RepositoryActionResult <Account>(accountToUpdate, RepositoryActionStatus.Updated)); } else { return(new RepositoryActionResult <Account>(accountToUpdate, RepositoryActionStatus.NothingModified, null)); } } catch (Exception) { throw; } }
public override async Task <DAL.App.DTO.Bill> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var bill = await RepositoryDbSet.FindAsync(id); if (bill != null) { await RepositoryDbContext.Entry(bill) .Reference(c => c.Client) .LoadAsync(); await RepositoryDbContext.Entry(bill) .Reference(c => c.WorkObject) .LoadAsync(); await RepositoryDbContext.Entry(bill) .Collection(c => c.Payments) // include paymentmethod? .LoadAsync(); await RepositoryDbContext.Entry(bill) .Collection(c => c.BillLines) .LoadAsync(); foreach (var billLine in bill.BillLines) { await RepositoryDbContext.Entry(billLine) .Reference(b => b.Product) .LoadAsync(); await RepositoryDbContext.Entry(billLine.Product) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } await RepositoryDbContext.Entry(bill) .Reference(c => c.Comment) .LoadAsync(); await RepositoryDbContext.Entry(bill.Comment) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } return(BillMapper.MapFromDomain(bill)); }
public override async Task <DTO.Schooling> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var schooling = await RepositoryDbSet.FindAsync(id); if (schooling != null) { await RepositoryDbContext.Entry(schooling) .Reference(c => c.SchoolingName) .LoadAsync(); await RepositoryDbContext.Entry(schooling.SchoolingName) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(schooling) .Reference(c => c.Material) .LoadAsync(); await RepositoryDbContext.Entry(schooling.Material) .Reference(c => c.MaterialName) .LoadAsync(); await RepositoryDbContext.Entry(schooling.Material.MaterialName) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(schooling) .Reference(c => c.Location) .LoadAsync(); await RepositoryDbContext.Entry(schooling.Location) .Reference(c => c.Locations) .LoadAsync(); await RepositoryDbContext.Entry(schooling.Location.Locations) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } return(SchoolingMapper.MapFromDomain(schooling)); }
public override async Task <DTO.Show> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var show = await RepositoryDbSet.FindAsync(id); if (show != null) { await RepositoryDbContext.Entry(show) .Reference(c => c.Title) .LoadAsync(); await RepositoryDbContext.Entry(show.Title) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(show) .Reference(c => c.Location) .LoadAsync(); await RepositoryDbContext.Entry(show.Location) .Reference(c => c.Locations) .LoadAsync(); await RepositoryDbContext.Entry(show.Location.Locations) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(show) .Reference(c => c.Comment) .LoadAsync(); await RepositoryDbContext.Entry(show.Comment) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } return(ShowMapper.MapFromDomain(show)); }
public async override Task <ContactType> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var contactType = await RepositoryDbSet.FindAsync(id); if (contactType != null) { await RepositoryDbContext.Entry(contactType) .Reference(c => c.ContactTypeValue) .LoadAsync(); await RepositoryDbContext.Entry(contactType.ContactTypeValue) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } return(ContactTypeMapper.MapFromDomain(contactType)); }
public override async Task <DAL.App.DTO.Identity.AppUser> FindAsync(params object[] id) { // return await RepositoryDbSet // .Include(d => d.AppUserInPositions) // .ThenInclude(d => d.AppUserPosition) // .ThenInclude(d => d.AppUserPositionValue) // .ThenInclude(d => d.Translations) // .Select(p => AppUserMapper.MapFromDomain(p)) // .FirstOrDefaultAsync(p => p.Id == (int) id[0]); var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var appUser = await RepositoryDbSet.FindAsync(id); if (appUser != null) { await RepositoryDbContext.Entry(appUser) .Collection(c => c.AppUserInPositions) .LoadAsync(); foreach (var appUserInPosition in appUser.AppUserInPositions) { await RepositoryDbContext.Entry(appUserInPosition) .Reference(c => c.AppUserPosition) .LoadAsync(); await RepositoryDbContext.Entry(appUserInPosition.AppUserPosition) .Reference(c => c.AppUserPositionValue) .LoadAsync(); await RepositoryDbContext.Entry(appUserInPosition.AppUserPosition.AppUserPositionValue) .Collection(c => c.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } } return(AppUserMapper.MapFromDomain(appUser)); }
public override async Task <Order> FindAsync(params object[] id) { var order = await RepositoryDbContext.Set <Domain.Order>().FindAsync(id); RepositoryDbContext.Entry(order).State = EntityState.Detached; return(OrderMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == order.Id) .Include(m => m.Description).ThenInclude(t => t.Translations) .Include(a => a.Shipper).ThenInclude(aa => aa.ShipperName).ThenInclude(t => t.Translations) .Include(a => a.Shipper).ThenInclude(aa => aa.ShipperAddress).ThenInclude(t => t.Translations) .Include(a => a.Shipper).ThenInclude(aa => aa.PhoneNumber).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations) .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations) .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(a => a.ProductsInOrder).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations) .FirstOrDefaultAsync())); }
public override async Task <Product> FindAsync(params object[] id) { var product = await RepositoryDbContext.Set <Domain.Product>().FindAsync(id); RepositoryDbContext.Entry(product).State = EntityState.Detached; return(ProductMapper.MapFromDomain(await RepositoryDbSet.AsNoTracking().Where(a => a.Id == product.Id) .Include(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(aa => aa.Length).ThenInclude(t => t.Translations) .Include(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(aa => aa.ShopCode).ThenInclude(t => t.Translations) .Include(p => p.Inventory).ThenInclude(i => i.Description).ThenInclude(t => t.Translations) .Include(m => m.Manufacturer).ThenInclude(mm => mm.ManuFacturerName).ThenInclude(t => t.Translations) .Include(m => m.Manufacturer).ThenInclude(mm => mm.Aadress).ThenInclude(t => t.Translations) .Include(m => m.Manufacturer).ThenInclude(mm => mm.PhoneNumber).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations) .Include(a => a.Comments).ThenInclude(aa => aa.CommentBody).ThenInclude(t => t.Translations) .Include(a => a.Comments).ThenInclude(aa => aa.CommentTitle).ThenInclude(t => t.Translations) .FirstOrDefaultAsync())); }
public void Update(TEntity entity) { DbSet.Attach(entity); Db.Entry(entity).State = EntityState.Modified; }
public override async Task <DTO.Registration> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var registration = await RepositoryDbSet.FindAsync(id); if (registration != null) { await RepositoryDbContext.Entry(registration) .Reference(c => c.Schooling) .LoadAsync(); await RepositoryDbContext.Entry(registration.Schooling) .Reference(c => c.SchoolingName) .LoadAsync(); await RepositoryDbContext.Entry(registration.Schooling.SchoolingName) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(registration) .Reference(c => c.Competition) .LoadAsync(); await RepositoryDbContext.Entry(registration.Competition) .Reference(c => c.Title) .LoadAsync(); await RepositoryDbContext.Entry(registration.Competition.Title) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(registration) .Reference(c => c.Competition) .LoadAsync(); await RepositoryDbContext.Entry(registration.Competition) .Reference(c => c.Comment) .LoadAsync(); await RepositoryDbContext.Entry(registration.Competition.Comment) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(registration) .Reference(c => c.Title) .LoadAsync(); await RepositoryDbContext.Entry(registration.Title) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(registration) .Reference(c => c.Comment) .LoadAsync(); await RepositoryDbContext.Entry(registration.Comment) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(registration) .Reference(c => c.Dog) .LoadAsync(); await RepositoryDbContext.Entry(registration.Dog) .Reference(c => c.Sex) .LoadAsync(); await RepositoryDbContext.Entry(registration.Dog.Sex) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(registration) .Reference(c => c.Participant) .LoadAsync(); await RepositoryDbContext.Entry(registration) .Reference(c => c.Show) .LoadAsync(); await RepositoryDbContext.Entry(registration.Show) .Reference(c => c.Title) .LoadAsync(); await RepositoryDbContext.Entry(registration.Show.Title) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(registration) .Reference(c => c.Show) .LoadAsync(); await RepositoryDbContext.Entry(registration.Show) .Reference(c => c.Comment) .LoadAsync(); await RepositoryDbContext.Entry(registration.Show.Comment) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); // } return(RegistrationMapper.MapFromDomain(registration)); }
public override async Task <DAL.App.DTO.WorkObject> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var workObject = await RepositoryDbSet.FindAsync(id); if (workObject != null) { await RepositoryDbContext.Entry(workObject) .Reference(c => c.Client) .LoadAsync(); // await RepositoryDbContext.Entry(workObject.Client) // .Collection(c => c.Bills) // .LoadAsync(); // // foreach (var bill in workObject.Bills) // { // await RepositoryDbContext.Entry(bill) // .Reference(b => b.Comment) // .LoadAsync(); // // await RepositoryDbContext.Entry(bill.Comment) // .Collection(b => b.Translations) // .Query() // .Where(t => t.Culture == culture) // .LoadAsync(); // } // // await RepositoryDbContext.Entry(workObject) // .Collection(c => c.AppUsersOnObject) // .LoadAsync(); // // foreach (var appUserOnObject in workObject.AppUsersOnObject) // { // await RepositoryDbContext.Entry(appUserOnObject) // .Reference(b => b.AppUser) // .LoadAsync(); // // } // // await RepositoryDbContext.Entry(workObject) // .Collection(c => c.ProductsServices) // .LoadAsync(); // // // foreach (var service in workObject.ProductsServices) // { // await RepositoryDbContext.Entry(service) // .Reference(b => b.Description) // .LoadAsync(); // // await RepositoryDbContext.Entry(service.Description) // .Collection(b => b.Translations) // .Query() // .Where(t => t.Culture == culture) // .LoadAsync(); // } } return(WorkObjectMapper.MapFromDomain(workObject)); }
public Task UpdateAsync(T entity) { // In case AsNoTracking is used _dbContext.Entry(entity).State = EntityState.Modified; return(_dbContext.SaveChangesAsync()); }
public override async Task <DAL.App.DTO.Client> FindAsync(params object[] id) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var client = await RepositoryDbSet.FindAsync(id); if (client != null) { await RepositoryDbContext.Entry(client) .Reference(c => c.ClientGroup) .LoadAsync(); await RepositoryDbContext.Entry(client.ClientGroup) .Reference(c => c.Name) .LoadAsync(); await RepositoryDbContext.Entry(client.ClientGroup) .Reference(c => c.Description) .LoadAsync(); await RepositoryDbContext.Entry(client.ClientGroup.Name) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(client.ClientGroup.Description) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); await RepositoryDbContext.Entry(client) .Collection(c => c.ProductsForClient) .LoadAsync(); foreach (var productForClient in client.ProductsForClient) { await RepositoryDbContext.Entry(productForClient) .Reference(b => b.Product) .LoadAsync(); await RepositoryDbContext.Entry(productForClient.Product) .Reference(b => b.ProductName) .LoadAsync(); await RepositoryDbContext.Entry(productForClient.Product.ProductName) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } await RepositoryDbContext.Entry(client) .Collection(c => c.Bills) .LoadAsync(); foreach (var bill in client.Bills) { await RepositoryDbContext.Entry(bill) .Reference(b => b.Comment) .LoadAsync(); await RepositoryDbContext.Entry(bill.Comment) .Collection(b => b.Translations) .Query() .Where(t => t.Culture == culture) .LoadAsync(); } } return(ClientMapper.MapFromDomain(client)); }