Exemplo n.º 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()));
        }
Exemplo n.º 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()));
        }
Exemplo n.º 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());
 }
 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());
 }
 public List <Ticket> AllForUser(string id)
 {
     return(RepositoryDbSet
            .Where(t => t.ApplicationUserId == id)
            .ToList());
 }
Exemplo n.º 6
0
 public List <Car> FindByPersonId(int personId)
 {
     return(RepositoryDbSet.Where(e => e.PersonId == personId).ToList());
 }
Exemplo n.º 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());
 }
Exemplo n.º 8
0
 public async Task <int> CountProductsInShop(int?shopId)
 {
     return(await RepositoryDbSet
            .Where(p => p.ShopId == shopId).CountAsync());
 }
Exemplo n.º 9
0
 public ForumTopic FindByAuthor(string author)
 {
     return(RepositoryDbSet
            .Where(p => p.Author.ToLower().Contains(author.ToLower()))
            .FirstOrDefault());
 }
Exemplo n.º 10
0
 public void DeleteAllRelationsForPerson(int personId)
 {
     RepositoryDbSet.RemoveRange(RepositoryDbSet.
                                 Where(w => w.Person1Id == personId || w.PersonId == personId));
 }
 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());
 }
 public async Task<List<ProductInCategory>> AllAsyncByCategoryId(int categoryId)
 {
     return await RepositoryDbSet
         .Where(a => a.CategoryId == categoryId).Select(e => ProductInCategoryMapper.MapFromDomain(e)).ToListAsync();
 }
Exemplo n.º 13
0
 public async Task <int> CountProductsInSale(int id)
 {
     return(await RepositoryDbSet
            .Where(s => s.SaleId == id)
            .CountAsync());
 }
Exemplo n.º 14
0
 public async Task <int> GetQuantity(int id)
 {
     return(await RepositoryDbSet
            .Where(p => p.Id == id)
            .Select(p => p.Quantity).FirstOrDefaultAsync());
 }
Exemplo n.º 15
0
 public async Task <Project> GetSingle(int id)
 {
     return(await RepositoryDbSet
            .Where(i => i.ProjectId == id)
            .SingleOrDefaultAsync());
 }
Exemplo n.º 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());
 }
Exemplo n.º 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));
 }
Exemplo n.º 19
0
 public async Task <int> FindIdByString(Relation relation)
 {
     return(await RepositoryDbSet
            .Where(w => w.Relation == relation)
            .Select(e => e.Id).FirstOrDefaultAsync());
 }
 private async Task <List <DiseaseSymptom> > GetByDiseaseIdAsync(int id)
 {
     return(await RepositoryDbSet.Where(d => d.DiseaseId == id).ToListAsync());
 }
Exemplo n.º 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());
 }
Exemplo n.º 22
0
 public List <Car> FindByLicensePlate(string licensePlate)
 {
     return(RepositoryDbSet.Where(e => e.LicensePlate == licensePlate).ToList());
 }
Exemplo n.º 23
0
 public List <Answer> FindAnswersbyAuthor(string answer)
 {
     return(RepositoryDbSet
            .Where(x => x.Author.ToLower().Contains(answer.ToLower()))
            .ToList());
 }
Exemplo n.º 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());
 }
Exemplo n.º 25
0
 public async Task <int> CountProductsInReturn(int returnId)
 {
     return(await RepositoryDbSet
            .Where(r => r.ReturnId == returnId).CountAsync());
 }
 public Ticket FindForUser(string id, int ticketId)
 {
     return(RepositoryDbSet
            .Where(t => t.ApplicationUserId == id && t.TicketId == ticketId)
            .SingleOrDefault());
 }
 public async Task <int> CountDefectItems(int defectId)
 {
     return(await RepositoryDbSet
            .Where(d => d.DefectId == defectId)
            .CountAsync());
 }