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 <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.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 <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.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 <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.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 <ManuFacturer> FindAsync(params object[] id) { var manuFacturer = await RepositoryDbSet.FindAsync(id); return(ManuFacturerMapper.MapFromDomain(await RepositoryDbSet .Include(m => m.ManuFacturerName).ThenInclude(t => t.Translations) .Include(m => m.Aadress).ThenInclude(t => t.Translations) .Include(m => m.PhoneNumber).ThenInclude(t => t.Translations).Where(m => m.Id == manuFacturer.Id).FirstOrDefaultAsync())); }
public override async Task <Shipper> FindAsync(params object[] id) { var shipper = await RepositoryDbSet.FindAsync(id); return(ShipperMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == shipper.Id) .Include(a => a.ShipperName).ThenInclude(t => t.Translations) .Include(a => a.ShipperAddress).ThenInclude(t => t.Translations) .Include(a => a.PhoneNumber).ThenInclude(t => t.Translations) .FirstOrDefaultAsync())); }
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 override async Task <Shop> FindAsync(params object[] id) { var shop = await RepositoryDbSet.FindAsync(id); return(ShopMapper.MapFromDomain(await RepositoryDbSet .Include(a => a.ShopName).ThenInclude(t => t.Translations) .Include(a => a.ShopAddress).ThenInclude(t => t.Translations) .Include(a => a.ShopContact).ThenInclude(t => t.Translations) .Include(a => a.ShopContact2).ThenInclude(t => t.Translations) .Where(a => a.Id == shop.Id) .FirstOrDefaultAsync())); }
public override async Task <DTO.DomainLikeDTO.ProductInOrder> FindAsync(params object[] id) { var productInOrder = await RepositoryDbSet.FindAsync(id); return(ProductInOrderMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == productInOrder.Id) .Include(p => p.Order).ThenInclude(m => m.Description).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations) .FirstOrDefaultAsync())); }
public override async Task<ProductInCategory> FindAsync(params object[] id) { var productInCategory = await RepositoryDbSet.FindAsync(id); return ProductInCategoryMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == productInCategory.Id) .Include(p => p.Category).ThenInclude(a => a.CategoryName).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations) .FirstOrDefaultAsync()); }
public override async Task <Sale> FindAsync(params object[] id) { var sale = await RepositoryDbSet.FindAsync(id); return(SaleMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == sale.Id) .Include(a => a.Description).ThenInclude(t => t.Translations) .Include(a => a.AppUser) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(a => a.ProductsSold).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations) .FirstOrDefaultAsync())); }
public override async Task <Defect> FindAsync(params object[] id) { var defect = await RepositoryDbSet.FindAsync(id); return(DefectMapper.MapFromDomain(await RepositoryDbSet .Include(d => d.Description).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.ProductsWithDefect).ThenInclude(aa => aa.Product).ThenInclude(aaa => aaa.ProductName).ThenInclude(t => t.Translations) .Where(a => a.Id == defect.Id) .FirstOrDefaultAsync())); }
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 <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 <DAL.App.DTO.DomainLikeDTO.Category> FindAsync(params object[] id) { var category = await RepositoryDbSet.FindAsync(id); return(CategoryMapper.MapFromDomain(await RepositoryDbSet .Include(a => a.CategoryName).ThenInclude(t => t.Translations) .Where(a => a.Id == category.Id) .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.ProductsInCategory).ThenInclude(aa => aa.Product).ThenInclude(aaa => aaa.ProductName) .ThenInclude(t => t.Translations) .FirstOrDefaultAsync())); }
public override async Task <Inventory> FindAsync(params object[] id) { var inventory = await RepositoryDbSet.FindAsync(id); return(InventoryMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == inventory.Id) .Include(i => i.Description).ThenInclude(t => t.Translations) .Include(a => a.Products).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(a => a.Products).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations) .Include(a => a.Products).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(a => a.Products).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(a => a.Products).ThenInclude(aa => aa.ShopCode).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) .FirstOrDefaultAsync())); }
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 override async Task <Comment> FindAsync(params object[] id) { var comment = await RepositoryDbSet.FindAsync(id); return(CommentMapper.MapFromDomain(await RepositoryDbSet .Include(a => a.CommentTitle).ThenInclude(t => t.Translations) .Include(a => a.CommentBody).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(a => a.Product).ThenInclude(aa => aa.ShopCode).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) .Where(a => a.Id == comment.Id) .FirstOrDefaultAsync())); }
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 <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.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)); }
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)); }