Beispiel #1
0
        /*
         * public virtual TDALEntity Update(TDALEntity entity)
         * {
         *  return _mapper.Map<TDALEntity>(RepositoryDbSet.Update(_mapper.Map<TDomainEntity>(entity)).Entity);
         * }
         */

        /// <summary>
        /// Get all the records, include contacts
        /// </summary>
        /// <returns></returns>
        public override async Task <List <DAL.App.DTO.ContactType> > AllAsync()
        {
            return(await RepositoryDbSet
                   .Include(m => m.ContactTypeValue)
                   .ThenInclude(t => t.Translations)
                   .Include(c => c.Contacts)
                   .Select(e => ContactTypeMapper.MapFromDomain(e)).ToListAsync());
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
 public async Task <List <BLL.App.DTO.ContactTypeWithContactCounts> > GetAllWithContactCountAsync()
 {
     return((await Uow.ContactTypes.GetAllWithContactCountAsync()).Select(e => ContactTypeMapper.MapFromDAL(e)).ToList());
 }