コード例 #1
0
        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()));
        }
コード例 #2
0
        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()));
        }
コード例 #3
0
 /// <summary>
 /// Get all acitve orders
 /// </summary>
 /// <param name="userId">Useraccont id</param>
 /// <returns> list of orders</returns>
 public List <TruckInOrder> GetAllTruckInOrders(int userId)
 {
     return(RepositoryDbSet
            .Where(o => o.Order.UnloadingDateTime > DateTime.Now && o.Order.UserAccontId == userId || o.Truck.UserAccontId == userId).ToList());
 }
コード例 #4
0
 public async Task <List <DAL.App.DTO.DomainLikeDTO.ProductWithDefect> > AllAsyncByDefectId(int defectId)
 {
     return(await RepositoryDbSet
            .Where(a => a.DefectId == defectId).Select(e => ProductWithDefectMapper.MapFromDomain(e)).ToListAsync());
 }
コード例 #5
0
 public List <Ticket> AllForUser(string id)
 {
     return(RepositoryDbSet
            .Where(t => t.ApplicationUserId == id)
            .ToList());
 }
コード例 #6
0
 public List <Car> FindByPersonId(int personId)
 {
     return(RepositoryDbSet.Where(e => e.PersonId == personId).ToList());
 }
コード例 #7
0
 public override async Task <List <DAL.App.DTO.Event> > AllAsync()
 {
     return(await RepositoryDbSet
            .Where(item => DateTime.Compare(item.EventDate, DateTime.Now) != -1)
            .Select(e => EventMapper.MapFromDomain(e)).ToListAsync());
 }
コード例 #8
0
 public async Task <int> CountProductsInShop(int?shopId)
 {
     return(await RepositoryDbSet
            .Where(p => p.ShopId == shopId).CountAsync());
 }
コード例 #9
0
 public ForumTopic FindByAuthor(string author)
 {
     return(RepositoryDbSet
            .Where(p => p.Author.ToLower().Contains(author.ToLower()))
            .FirstOrDefault());
 }
コード例 #10
0
 public void DeleteAllRelationsForPerson(int personId)
 {
     RepositoryDbSet.RemoveRange(RepositoryDbSet.
                                 Where(w => w.Person1Id == personId || w.PersonId == personId));
 }
コード例 #11
0
 public async Task <List <DAL.App.DTO.Person> > AllForUserAsync(int userId)
 {
     return(await RepositoryDbSet.Where(p => p.AppUserId == userId).Select(e => PersonMapper.MapFromDomain(e))
            .ToListAsync());
 }
コード例 #12
0
 public async Task<List<ProductInCategory>> AllAsyncByCategoryId(int categoryId)
 {
     return await RepositoryDbSet
         .Where(a => a.CategoryId == categoryId).Select(e => ProductInCategoryMapper.MapFromDomain(e)).ToListAsync();
 }
コード例 #13
0
 public async Task <int> CountProductsInSale(int id)
 {
     return(await RepositoryDbSet
            .Where(s => s.SaleId == id)
            .CountAsync());
 }
コード例 #14
0
 public async Task <int> GetQuantity(int id)
 {
     return(await RepositoryDbSet
            .Where(p => p.Id == id)
            .Select(p => p.Quantity).FirstOrDefaultAsync());
 }
コード例 #15
0
 public async Task <Project> GetSingle(int id)
 {
     return(await RepositoryDbSet
            .Where(i => i.ProjectId == id)
            .SingleOrDefaultAsync());
 }
コード例 #16
0
 public ForumTopic FindTopicByTitle(string title)
 {
     return(RepositoryDbSet
            .Where(p => p.Title.ToLower().Contains(title.ToLower()))
            .FirstOrDefault());
 }
 public PerformancePerformer FindByBothIds(int performanceId, int performerId)
 {
     return(RepositoryDbSet
            .Where(pp => pp.PerformanceId == performanceId && pp.PerformerId == performerId)
            .SingleOrDefault());
 }
コード例 #18
0
 public async Task <IList <Claim> > GetClaimsAsync(TKey roleId, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await RepositoryDbSet.Where(predicate : rc => rc.IdentityRoleId.Equals(roleId)).Select(selector: c => new Claim(c.ClaimType, c.ClaimValue)).ToListAsync(cancellationToken: cancellationToken));
 }
コード例 #19
0
 public async Task <int> FindIdByString(Relation relation)
 {
     return(await RepositoryDbSet
            .Where(w => w.Relation == relation)
            .Select(e => e.Id).FirstOrDefaultAsync());
 }
コード例 #20
0
 private async Task <List <DiseaseSymptom> > GetByDiseaseIdAsync(int id)
 {
     return(await RepositoryDbSet.Where(d => d.DiseaseId == id).ToListAsync());
 }
コード例 #21
0
 public async Task <IEnumerable <Picture> > FindPicturesByPathAsync(string path)
 {
     return(await RepositoryDbSet.Where(pic => pic.Path == path).AsNoTracking()
            .Select(p => PictureMapper.MapFromDomain(p)).ToListAsync());
 }
コード例 #22
0
 public List <Car> FindByLicensePlate(string licensePlate)
 {
     return(RepositoryDbSet.Where(e => e.LicensePlate == licensePlate).ToList());
 }
コード例 #23
0
 public List <Answer> FindAnswersbyAuthor(string answer)
 {
     return(RepositoryDbSet
            .Where(x => x.Author.ToLower().Contains(answer.ToLower()))
            .ToList());
 }
コード例 #24
0
 public async Task <List <DTO.DomainLikeDTO.ProductReturned> > AllAsyncByReturnId(int returnId)
 {
     return(await RepositoryDbSet
            .Where(p => p.ReturnId == returnId).Select(e => ProductReturnedMapper.MapFromDomain(e)).ToListAsync());
 }
コード例 #25
0
 public async Task <int> CountProductsInReturn(int returnId)
 {
     return(await RepositoryDbSet
            .Where(r => r.ReturnId == returnId).CountAsync());
 }
コード例 #26
0
 public Ticket FindForUser(string id, int ticketId)
 {
     return(RepositoryDbSet
            .Where(t => t.ApplicationUserId == id && t.TicketId == ticketId)
            .SingleOrDefault());
 }
コード例 #27
0
 public async Task <int> CountDefectItems(int defectId)
 {
     return(await RepositoryDbSet
            .Where(d => d.DefectId == defectId)
            .CountAsync());
 }