public virtual async Task <IEnumerable <ItemView> > GetItemsForViewAsync(Guid?categoryId, string?search) { var items = RepoDbSet.AsNoTracking() .Include(i => i.Images) .Include(l => l.Location) .Include(p => p.Prices).AsQueryable(); if (!String.IsNullOrEmpty(search)) { items = items .Where(d => d.Description.ToLower().Contains(search.ToLower()) || d.Brand.ToLower().Contains(search.ToLower()) || d.Model.ToLower().Contains(search.ToLower()) || d.Location !.City.ToLower().Contains(search.ToLower())); } if (categoryId != Guid.Empty) { items = items .Where(c => c.ItemCategories.Any(a => a.CategoryId == categoryId)); } if (!String.IsNullOrEmpty(search) || categoryId != Guid.Empty) { return(await items .Select(a => new ItemView() { Id = a.Id, Description = a.Description, Image = a.Images.FirstOrDefault().Picture, AddressLine = a.Location !.AddressLine, Price = a.Prices.FirstOrDefault(p => p.RentalPeriod !.Description == "Päev").ItemPrice }).ToListAsync());
public async Task <DTO.BodyMeasurement> FindWithAppUserIdAsync(Guid id, Guid appUserId) { return(Mapper.MapDomainToDAL( await RepoDbSet .AsNoTracking() .FirstOrDefaultAsync(d => d.Id == id && d.AppUserId == appUserId) )); }
public override async Task <DTO.BodyMeasurement> FindAsync(Guid id) { return(Mapper.MapDomainToDAL( await RepoDbSet .AsNoTracking() .FirstOrDefaultAsync(d => d.Id == id) )); }
public override async Task <IEnumerable <DTO.DailyNutritionIntake> > AllAsync() { return(( await RepoDbSet .AsNoTracking() .ToListAsync() ).Select(domainEntity => Mapper.MapDomainToDAL(domainEntity))); }
public string?GetLastInvoiceNumber() { var invoices = RepoDbSet.AsNoTracking().OrderByDescending(a => a.InvoiceNumber).ToListAsync(); if (invoices.Result.Count == 0) { return(null); } return(invoices.Result.FirstOrDefault().InvoiceNumber); }
public async Task <IEnumerable <DTO.LangStr> > GetLanguageStrings() { return(await RepoDbSet.AsNoTracking() .Include(l => l.Translations) .Select(a => new DTO.LangStr() { Id = a.Id, CultureCount = a.Translations !.Count, CurrentValue = a })
public string?GetLastBookingNumber() { var bookings = RepoDbSet.AsNoTracking().OrderByDescending(a => a.BookingNumber).ToListAsync(); if (bookings.Result.Count == 0) { return(null); } return(bookings.Result.FirstOrDefault().BookingNumber); }
public async Task <DTO.WorkoutRoutine> ActiveRoutineForUserWithIdAsync(Guid userId) { return(Mapper.MapDomainToDAL( await RepoDbSet .AsNoTracking() .Include(routine => routine.WorkoutRoutineInfos) .SingleOrDefaultAsync( w => w.AppUserId.Equals(userId) && w.CreatedAt <= DateTime.Now && w.ClosedAt > DateTime.Now) )); }
public override async Task <DAL.App.DTO.Property> FirstOrDefaultAsync(Guid id, object?userId = null) { var query = (await RepoDbSet.AsNoTracking() .Include(p => p.Reviews) .Include(p => p.PropertyRules) .Include(p => p.Extras) .Include(property => property.PropertyRooms) .ThenInclude(room => room.RoomFacilities) .ThenInclude(rf => rf.Facility) .FirstOrDefaultAsync(a => a.Id == id)); return(Mapper.Map(query)); }
public async Task <IEnumerable <DTO.ExerciseSet> > AllWithExerciseInTrainingDayIdAsync( Guid exerciseInTrainingDayId) { var domainObjects = await RepoDbSet .AsNoTracking() .Include(s => s.SetType) .Include(s => s.UnitType) .Where(s => s.ExerciseInTrainingDay.Id == exerciseInTrainingDayId) .ToListAsync(); var dalObjects = domainObjects.Select(Mapper.MapDomainToDAL); return(dalObjects); }
public override async Task <DTO.TrainingDay> FindAsync(Guid id) { var domainEntity = await RepoDbSet .AsNoTracking() .Include(d => d.TrainingDayType) .Include(d => d.ExercisesInTrainingDay) .ThenInclude(e => e.ExerciseSets) .ThenInclude(s => s.SetType) .Include(d => d.ExercisesInTrainingDay) .ThenInclude(e => e.ExerciseType) .Include(d => d.ExercisesInTrainingDay) .ThenInclude(e => e.Exercise) .FirstOrDefaultAsync(d => d.Id == id); var dalEntity = Mapper.MapDomainToDAL(domainEntity); return(dalEntity); }
public Guid GetRentalPeriodId(string period) { return(RepoDbSet.AsNoTracking().Single(d => d.Description.Equals(period)).Id); }
public async Task <DTO.DailyNutritionIntake> FindWithAppUserIdAsync(Guid id, Guid appUserId) { return(Mapper.MapDomainToDAL(await RepoDbSet .AsNoTracking() .SingleOrDefaultAsync(d => d.Id == id && d.AppUserId == appUserId))); }
public override async Task <DTO.DailyNutritionIntake> FindAsync(Guid id) { return(Mapper.MapDomainToDAL(await RepoDbSet .AsNoTracking() .SingleOrDefaultAsync(d => d.Id == id))); }