public async Task <List <Disease> > GetDiseasesWithSymptomsAsync() { return(await RepositoryDbSet .Include(d => d.Symptoms) .ThenInclude(s => s.Symptom) .ToListAsync()); }
public override async Task <List <DAL.App.DTO.UserSkill> > AllAsync() { return(await RepositoryDbSet .Include(a => a.AppUser) .Include(u => u.Skill) .Select(e => UserSkillMapper.MapFromDomain(e)).ToListAsync()); }
public IEnumerable <Location> AllByTypeId(int id) { return(RepositoryDbSet .Include(l => l.LocationType) .Where(l => l.LocationTypeId == id) .ToList()); }
public async Task <CompanyType> GetSingle(int id) { return(await RepositoryDbSet .Include(t => t.CompanyTypeName) .ThenInclude(t => t.Translations) .SingleOrDefaultAsync(m => m.CompanyTypeId == id)); }
public override Promotion Find(params object[] id) { return(RepositoryDbSet .Include(p => p.Menus) .Include(p => p.Dishes) .SingleOrDefault(x => (int)id[0] == x.PromotionId)); }
public override async Task <List <CompanyRole> > AllAsync() { return(await RepositoryDbSet .Include(c => c.Company) .Include(r => r.CRole) .Select(e => CompanyRoleMapper.MapFromDomain(e)).ToListAsync()); }
public async Task <Registration> FindForUserAsync(int id, int userId) { return(RegistrationMapper.MapFromDomain(await RepositoryDbSet .Include(a => a.Title) .ThenInclude(a => a.Translations) .Include(a => a.Comment) .ThenInclude(a => a.Translations) .Include(a => a.Dog) .ThenInclude(a => a.Sex) .ThenInclude(a => a.Translations) .Include(a => a.Participant) .Include(a => a.Schooling) .ThenInclude(a => a.SchoolingName) .ThenInclude(a => a.Translations) .Include(a => a.Show) .ThenInclude(a => a.Title) .ThenInclude(a => a.Translations) .Include(a => a.Show) .ThenInclude(a => a.Comment) .ThenInclude(a => a.Translations) .Include(a => a.Competition) .ThenInclude(a => a.Title) .ThenInclude(a => a.Translations) .Include(a => a.Competition) .ThenInclude(a => a.Comment) .ThenInclude(a => a.Translations) .Include(a => a.Schooling) .ThenInclude(a => a.SchoolingName) .ThenInclude(a => a.Translations) .FirstOrDefaultAsync(a => a.Dog.AppUserId == userId))); }
public async Task <DefectWithProductCount> FindProductsWithDefectByShopAsync(int id, int?shopId) { var res = await RepositoryDbSet .Include(d => d.ProductsWithDefect) .Include(d => d.Description).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations) .Where(d => d.ShopId == shopId && d.Id == id) .Select(d => new { Id = d.Id, Description = d.Description, ShopId = d.ShopId, ShopName = d.Shop.ShopName, ProductsWithDefectCount = d.ProductsWithDefect.Count, DescriptionTranslation = d.Description.Translations, ShopNameTranslations = d.Shop.ShopName.Translations }).FirstOrDefaultAsync(); var result = new DefectWithProductCount() { Id = res.Id, Description = res.Description.Translate(), ShopId = res.ShopId, ShopName = res.ShopName.Translate(), ProductsWithDefectCount = res.ProductsWithDefectCount }; return(result); }
public virtual async Task <DTO.Comment> GetCommentByIdAndShop(int id, int?shopId) { var res = 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) .Where(s => s.Id == id && s.ShopId == shopId) .Select(c => new { Id = c.Id, CommentTitle = c.CommentTitle, CommentBody = c.CommentBody, ProductName = c.Product.ProductName, ProductId = c.ProductId, ShopId = c.ShopId, CommentBodyTranslations = c.CommentBody.Translations, CommentTitleTranslations = c.CommentTitle.Translations, ProductNameTranslations = c.Product.ProductName.Translations }).FirstOrDefaultAsync(); var result = new DTO.Comment() { Id = res.Id, CommentTitle = res.CommentTitle.Translate(), CommentBody = res.CommentBody.Translate(), ProductName = res.ProductName.Translate(), ProductId = res.ProductId, ShopId = res.ShopId }; return(result); }
public override async Task <List <Product> > AllAsync() { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var res = await RepositoryDbSet .Include(p => p.ProductName) .ThenInclude(t => t.Translations) .Select(c => new { Id = c.Id, ProductName = c.ProductName, Translations = c.ProductName.Translations, ProductCode = c.ProductCode, Price = c.Price }) .ToListAsync(); var resultList = res.Select(c => new Product() { Id = c.Id, ProductName = c.ProductName.Translate(), ProductCode = c.ProductCode, Price = c.Price }).ToList(); return(resultList); }
public override Ingredient Find(params object[] id) { return(RepositoryDbSet .Include(d => d.DishIngredients) .ThenInclude(di => di.Dish) .SingleOrDefault(x => (int)id[0] == x.IngredientId)); }
public async Task <ManuFacturerWithProductCount> FindByIdAndShop(int id, int?shopId) { var res = 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) .Include(a => a.Products) .Select(m => new { Id = m.Id, Aadress = m.Aadress, ManuFacturerName = m.ManuFacturerName, PhoneNumber = m.PhoneNumber, ProductCount = m.Products.Count(p => p.ShopId == shopId), ManuFacturerNameTranslations = m.ManuFacturerName.Translations, AddressTranslations = m.Aadress.Translations, PhoneNumberTranslations = m.PhoneNumber.Translations }) .Where(m => m.Id == id).FirstOrDefaultAsync(); var result = new ManuFacturerWithProductCount() { Id = res.Id, Aadress = res.Aadress.Translate(), ManuFacturerName = res.ManuFacturerName.Translate(), PhoneNumber = res.PhoneNumber.Translate(), ProductCount = res.ProductCount }; return(result); }
public override async Task <List <ManuFacturer> > AllAsync() { return(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).Select(e => ManuFacturerMapper.MapFromDomain(e)).ToListAsync()); }
public IEnumerable <Invoice> AllForUser(string id) { return(RepositoryDbSet .Include(i => i.InvoiceRows) .Where(i => i.ApplicationUserId == id) .ToList()); }
public async Task <List <DAL.App.DTO.ProductClassification> > AllProductsWithClassification(int id) { return(await RepositoryDbSet .Include(c => c.Products) .Include(r => r.ProductClassificationValue) .Select(e => ProductClassificationMapper.MapFromDomain(e)).ToListAsync()); }
public virtual async Task <List <DAL.App.DTO.CategoryWithProductCount> > GetAllWithProductCountForShopAsync(int?shopId, string search, int?pageIndex, int?pageSize) { var query = RepositoryDbSet .Include(a => a.CategoryName).ThenInclude(t => t.Translations) .Where(s => s.ShopId == shopId).AsQueryable(); query = Search(query, search); if (pageIndex != null && pageSize != null) { var tempPageIndex = pageIndex.GetValueOrDefault(); var tempPageSize = pageSize.GetValueOrDefault(); query = query.Skip((tempPageIndex - 1) * tempPageSize).Take(tempPageSize); } var res = await query.Select(c => new { Id = c.Id, CategoryName = c.CategoryName, CategoryProductCount = c.ProductsInCategory.Count, CategoryNameTranslations = c.CategoryName.Translations }).ToListAsync(); var resultList = res.Select(c => new CategoryWithProductCount() { Id = c.Id, CategoryName = c.CategoryName.Translate(), CategoryProductCount = c.CategoryProductCount }).ToList(); return(resultList); }
public virtual async Task <List <AppUserPositionWithAppUsersCount> > GetAllWithAppUsersCountAsync() { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var res = await RepositoryDbSet .Include(a => a.AppUserPositionValue) .ThenInclude(t => t.Translations) .Select(c => new { Id = c.Id, AppUserPositionValue = c.AppUserPositionValue, Translations = c.AppUserPositionValue.Translations, AppUsersCount = c.AppUsersInPosition.Count }) .ToListAsync(); var resultList = res.Select(c => new AppUserPositionWithAppUsersCount() { Id = c.Id, AppUsersCount = c.AppUsersCount, AppUserPositionValue = c.AppUserPositionValue.Translate() }).ToList(); return(resultList); }
public async Task <List <Product> > AllAsync(string order, string searchFor, int?pageIndex, int?pageSize) { var query = RepositoryDbSet .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) .AsQueryable(); query = Search(query, searchFor); query = Order(query, order); if (pageIndex != null && pageSize != null) { query = query.Skip((pageIndex.Value - 1) * pageSize.Value).Take(pageSize.Value); } var temp = await query.ToListAsync(); var res = temp.Select(e => ProductMapper.MapFromDomain(e)).ToList(); return(res); }
public override async Task <List <DAL.App.DTO.Registration> > AllAsync() { return(await RepositoryDbSet .Include(a => a.Dog) .ThenInclude(dog => dog.Sex) .ThenInclude(sex => sex.Translations) .Include(a => a.Dog) .ThenInclude(a => a.AppUser) .Include(m => m.Title) .ThenInclude(t => t.Translations) .Include(n => n.Comment) .ThenInclude(t => t.Translations) .Include(a => a.Schooling) .ThenInclude(a => a.SchoolingName) .ThenInclude(a => a.Translations) .Include(a => a.Show) .ThenInclude(a => a.Title) .ThenInclude(a => a.Translations) .Include(a => a.Show) .ThenInclude(a => a.Comment) .ThenInclude(a => a.Translations) .Include(a => a.Participant) .Include(a => a.Competition) .ThenInclude(comp => comp.Comment) .ThenInclude(comment => comment.Translations) .Include(a => a.Competition) .ThenInclude(comp => comp.Title) .ThenInclude(title => title.Translations) .Select(e => RegistrationMapper.MapFromDomain(e)).ToListAsync()); }
public override Product Update(Product entity) { var entityInDb = RepositoryDbSet .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) .FirstOrDefault(x => x.Id == entity.Id); if (entityInDb == null) { return(entity); } entityInDb.Quantity = entity.Quantity; entityInDb.BuyPrice = entity.BuyPrice; entityInDb.PercentageAddedToBuyPrice = entity.PercentageAddedToBuyPrice; entityInDb.SellPrice = entity.SellPrice; entityInDb.ManuFacturerId = entity.ManuFacturerId; entityInDb.InventoryId = entity.InventoryId; entityInDb.ShopId = entity.ShopId; RepositoryDbSet.Update(entityInDb); entityInDb.ProductName.SetTranslation(entity.ProductName); entityInDb.Length.SetTranslation(entity.Length); entityInDb.Weight.SetTranslation(entity.Weight); entityInDb.ManuFacturerItemCode.SetTranslation(entity.ManuFacturerItemCode); entityInDb.ShopCode.SetTranslation(entity.ShopCode); return(entity); }
public async Task <InventoryWithProductCount> FindByShopAsyncAndIdAsync(int id, int?shopId) { var res = await RepositoryDbSet .Include(i => i.Description).ThenInclude(t => t.Translations) .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations) .Where(i => i.ShopId == shopId && i.Id == id) .Select(i => new { Id = i.Id, Description = i.Description, InventoryCreationTime = i.InventoryCreationTime, ShopId = i.ShopId, ShopName = i.Shop.ShopName, ProductCount = i.Products.Count, DescriptionTranslation = i.Description.Translations, ShopNameTranslations = i.Shop.ShopName.Translations }) .FirstOrDefaultAsync(); var result = new InventoryWithProductCount() { Id = res.Id, Description = res.Description.Translate(), InventoryCreationTime = res.InventoryCreationTime, ShopId = res.ShopId, ShopName = res.ShopName.Translate(), ProductCount = res.ProductCount }; return(result); }
public async Task <List <DTO.DomainLikeDTO.Product> > AllAsyncByShopForDropDown(int?shopId) { return(await RepositoryDbSet .Include(aa => aa.ProductName).ThenInclude(t => t.Translations) .Where(p => p.ShopId == shopId) .Select(e => ProductMapper.MapFromDomain(e)).ToListAsync()); }
public virtual async Task <List <MaterialCounts> > GetAllWithMaterialCountAsync() { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var res = await RepositoryDbSet .Include(m => m.MaterialName) .ThenInclude(t => t.Translations) //.Where(x => x.ContactTypeValue.Translations.Any(t => t.Culture == culture)) .Select(c => new { Id = c.Id, MaterialName = c.MaterialName, Translations = c.MaterialName.Translations, MaterialCounts = c.Schoolings.Count }) .ToListAsync(); var resultList = res.Select(c => new MaterialCounts() { Id = c.Id, MaterialCount = c.MaterialCounts, MaterialName = c.MaterialName.Translate() }).ToList(); return(resultList); }
public async Task <ShipperWithOrderCount> FindByIdAsyncDTO(int id) { var res = await RepositoryDbSet .Include(a => a.ShipperName).ThenInclude(t => t.Translations) .Include(a => a.ShipperAddress).ThenInclude(t => t.Translations) .Include(a => a.PhoneNumber).ThenInclude(t => t.Translations) .Where(s => s.Id == id) .Select(s => new { Id = s.Id, ShipperName = s.ShipperName, ShipperAddress = s.ShipperAddress, PhoneNumber = s.PhoneNumber, OrdersCount = s.Orders.Count, ShipperNameTranslations = s.ShipperName.Translations, ShipperAddressTranslations = s.ShipperAddress.Translations, PhoneNumberTranslations = s.PhoneNumber.Translations }) .FirstOrDefaultAsync(); var result = new ShipperWithOrderCount() { Id = res.Id, ShipperName = res.ShipperName.Translate(), ShipperAddress = res.ShipperAddress.Translate(), PhoneNumber = res.PhoneNumber.Translate(), OrdersCount = res.OrdersCount }; return(result); }
public override async Task <List <DAL.App.DTO.Price> > AllAsync() { return(await RepositoryDbSet .Include(price => price.FoodItem) .Select(price => PriceMapper.MapFromDomain(price)) .ToListAsync()); }
public IEnumerable <MenuDish> FindByMenuId(params object[] id) { return(RepositoryDbSet .Include(md => md.Dish) .Where(x => (int)id[0] == x.MenuId) .ToList()); }
public async Task <CompanyFieldOfActivity> GetSingle(int id) { return(await RepositoryDbSet .Include(i => i.ActivityName) .ThenInclude(i => i.Translations) .SingleOrDefaultAsync(m => m.CompanyFieldOfActivityId == id)); }
public async Task <List <Return> > AllAsyncByShop(int?shopId, string order, string searchFor, int?pageIndex, int?pageSize) { var query = RepositoryDbSet .Include(a => a.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.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName) .ThenInclude(t => t.Translations) .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length) .ThenInclude(t => t.Translations) .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight) .ThenInclude(t => t.Translations) .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode) .ThenInclude(t => t.Translations) .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode) .ThenInclude(t => t.Translations) .Where(p => p.ShopId == shopId) .AsQueryable(); query = Search(query, searchFor); query = Order(query, order); if (pageIndex != null && pageSize != null) { query = query.Skip((pageIndex.Value - 1) * pageSize.Value).Take(pageSize.Value); } var temp = await query.ToListAsync(); var res = temp.Select(e => ReturnMapper.MapFromDomain(e)).ToList(); return(res); }
public async Task <IEnumerable <Location> > AllByTypeIdAsync(int id) { return(await RepositoryDbSet .Include(l => l.LocationType) .Where(l => l.LocationTypeId == id) .ToListAsync()); }
public async Task <List <DAL.App.DTO.Schooling> > AllForUserAsync(int userId) { var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower(); var res = await RepositoryDbSet .Include(a => a.Material) .ThenInclude(a => a.MaterialName) .Select(c => new { Id = c.Id, Start = c.Start, SchoolingName = c.SchoolingName, Translations = c.SchoolingName.Translations, }) .ToListAsync(); var resultList = res.Select(c => new DTO.Schooling() { Id = c.Id, SchoolingName = c.SchoolingName.Translate(), Start = c.Start, }).ToList(); return(resultList); }