示例#1
0
 public async Task <List <BillLine> > AllForUserAsync(int userId)
 {
     return((await Uow.BillLines
             .AllForUserAsync(userId))
            .Select(e => BillLineMapper
                    .MapFromDAL(e)).ToList());
 }
示例#2
0
        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));
        }
示例#3
0
        public async Task <BillLine> FindForUserAsync(int id, int userId)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var contact = await RepositoryDbSet
                          .Include(p => p.Product)
                          .ThenInclude(t => t.Translations)
                          .Include(c => c.Bill) //need to include more?
                          .FirstOrDefaultAsync(m => m.Id == id && m.Bill.WorkObject.AppUsersOnObject.Any(p => p.AppUserId == userId));

            return(BillLineMapper.MapFromDomain(contact));
        }
示例#4
0
        public async Task <List <BillLine> > AllForUserAsync(int userId)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var res = await RepositoryDbSet
                      .Include(p => p.Bill)
                      .Include(p => p.Product)
                      .ThenInclude(t => t.Translations)
                      .Where(p => p.Bill.WorkObject.AppUsersOnObject.Any(q => q.AppUserId == userId))
                      .Select(e => BillLineMapper.MapFromDomain(e))
                      .ToListAsync();

            return(res);
        }
示例#5
0
        public override async Task <List <DAL.App.DTO.BillLine> > AllAsync()
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var res = await RepositoryDbSet
                      .Include(p => p.Product)
                      .ThenInclude(t => t.Translations)
                      .Include(p => p.Bill)
                      .ThenInclude(p => p.Comment)
                      .ThenInclude(p => p.Translations)
                      .Select(e => BillLineMapper.MapFromDomain(e))
                      .ToListAsync();

            return(res);
        }
示例#6
0
 public async Task <BillLine> FindForUserAsync(int id, int userId)
 {
     return(BillLineMapper.MapFromDAL(await Uow.BillLines.FindForUserAsync(id, userId)));
 }