public override async Task <WorkingHours> FirstOrDefaultAsync(Guid id, object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var entity = await query .Include(w => w.Restaurant) .FirstOrDefaultAsync(e => e.Id.Equals(id)); return(DALMapper.Map(entity)); }
public override async Task <Address> FirstOrDefaultAsync(Guid id, object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var entity = await query .Include(a => a.AppUser) .FirstOrDefaultAsync(e => e.Id.Equals(id)); return(DALMapper.Map(entity)); }
public override async Task <NutritionInfo> FirstOrDefaultAsync(Guid id, object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var entity = await query .Include(n => n.Item) .FirstOrDefaultAsync(e => e.Id.Equals(id)); return(DALMapper.Map(entity)); }
public override async Task <OrderItemChoice> FirstOrDefaultAsync(Guid id, object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var entity = await query .Include(oic => oic.ItemChoice) .Include(oic => oic.OrderRow) .FirstOrDefaultAsync(e => e.Id.Equals(id)); return(DALMapper.Map(entity)); }
public override async Task <Translation> FirstOrDefaultAsync(Guid id, object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var entity = await query .Include(t => t.LangString) .ThenInclude(l => l !.CategoryNames) .FirstOrDefaultAsync(e => e.Id.Equals(id)); return(DALMapper.Map(entity)); }
public override async Task <IEnumerable <Address> > GetAllAsync(object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var domainEntities = await query .Include(a => a.AppUser) .ToListAsync(); var result = domainEntities.Select(e => DALMapper.Map(e)); return(result); }
public override async Task <ItemInType> FirstOrDefaultAsync(Guid id, object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var entity = await query .Include(io => io !.Item) .Include(iit => iit.ItemType) .FirstOrDefaultAsync(e => e.Id.Equals(id)); return(DALMapper.Map(entity)); }
public override async Task <IEnumerable <Translation> > GetAllAsync(object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var domainEntities = await query .Include(t => t.LangString) .ThenInclude(l => l !.CategoryNames) .ToListAsync(); var result = domainEntities.Select(e => DALMapper.Map(e)); return(result); }
public override async Task <IEnumerable <ItemInType> > GetAllAsync(object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var domainEntities = await query .Include(io => io !.Item) .Include(iit => iit.ItemType) .ToListAsync(); var result = domainEntities.Select(e => DALMapper.Map(e)); return(result); }
public override async Task <Question> FirstOrDefaultAsync(Guid id, object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var entity = await query .Include(a => a.CorrectChoice) .Include(a => a.Choices) .ThenInclude(a => a.Answers) .Include(a => a.Quiz) .FirstOrDefaultAsync(e => e.Id.Equals(id)); return(DALMapper.Map(entity)); }
public override async Task <IEnumerable <OrderItemChoice> > GetAllAsync(object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var domainEntities = await query .Include(oic => oic.ItemChoice) .Include(oic => oic.OrderRow) .ToListAsync(); var result = domainEntities.Select(e => DALMapper.Map(e)); return(result); }
public override async Task <RestaurantCategory> FirstOrDefaultAsync(Guid id, object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var entity = await query .Include(r => r.Category) .ThenInclude(l => l !.Name) .ThenInclude(t => t !.Translations) .Include(r => r.Restaurant) .FirstOrDefaultAsync(e => e.Id.Equals(id)); return(DALMapper.Map(entity)); }
public async Task <IEnumerable <ItemType> > GetAllByRestaurantAsync(Guid restaurantId, object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var domainEntities = await query.Where(item => item.RestaurantId.Equals(restaurantId)) .Include(it => it.ItemInTypes) .ThenInclude(iit => iit.Item) .Include(it => it.Restaurant) .ToListAsync(); var result = domainEntities.Select(e => DALMapper.Map(e)); return(result); }
public override IEnumerable <Category> GetAll(object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var domainEntities = query .Include(с => с.RestaurantCategories) .ThenInclude(rc => rc.Restaurant) .Include(l => l.Name) .ThenInclude(t => t !.Translations) .ToList(); var result = domainEntities.Select(e => DALMapper.Map(e)); return(result); }
public override async Task <IEnumerable <Question> > GetAllAsync(object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var domainEntities = await query .Include(a => a.CorrectChoice) .Include(a => a.Choices) .ThenInclude(a => a.Answers) .Include(a => a.Quiz) .ToListAsync(); var result = domainEntities.Select(e => DALMapper.Map(e)); return(result); }
public override IEnumerable <Quiz> GetAll(object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var domainEntities = query .Include(a => a.AppUser) .Include(a => a.Questions) .ThenInclude(a => a.Choices) .ThenInclude(a => a.Answers) .Include(e => e.QuizSessions) .ToList(); var result = domainEntities.Select(e => DALMapper.Map(e)); return(result); }
public async Task <IEnumerable <Order> > GetAllByRestaurantAsync(Guid restaurantId, object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var domainEntities = await query.Where(order => order.RestaurantId.Equals(restaurantId)) .Include(a => a.AppUser) .Include(o => o.Restaurant) .Include(o => o.OrderRows) .ThenInclude(or => or.OrderItemChoices) .ThenInclude(oic => oic.ItemChoice) .ToListAsync(); var result = domainEntities.Select(e => DALMapper.Map(e)); return(result); }
public override async Task <Category> UpdateAsync(Category entity, object?userId = null) { var domainEntity = DALMapper.Map(entity); // fix the language string - from mapper we get new ones - so duplicate values will be created in db // load back from db the originals domainEntity.Name = await RepoDbContext.LangStrings.Include(t => t.Translations).FirstAsync(s => s.Id == domainEntity.NameId); domainEntity.Name.SetTranslation(entity.Name); await CheckDomainEntityOwnership(domainEntity, userId); var trackedDomainEntity = RepoDbSet.Update(domainEntity).Entity; var result = DALMapper.Map(trackedDomainEntity); return(result); }
public override async Task <IEnumerable <Restaurant> > GetAllAsync(object?userId = null, bool noTracking = true) { var query = PrepareQuery(userId, noTracking); var domainEntities = await query .Include(r => r.RestaurantCategories) .ThenInclude(rc => rc.Category) .ThenInclude(l => l !.Name) .ThenInclude(t => t !.Translations) .Include(r => r.WorkingHourses) .Include(r => r.ItemTypes) .ThenInclude(it => it.ItemInTypes) .ThenInclude(iit => iit.Item) .ToListAsync(); var result = domainEntities.Select(e => DALMapper.Map(e)); return(result); }