Пример #1
0
        public async Task <IEnumerable <BL.Models.Activity> > GetActivityList(GetActivitiesContext context)
        {
            IQueryable <Models.Activity> query = Context.Activity
                                                 .Where(a => context.Id == null || a.Id == context.Id)
                                                 .Where(a => context.Name == null || a.Name.Contains(context.Name))
                                                 .AsQueryable();

            IEnumerable <DAL.Models.Activity> sqlActivities = await query.ToListAsync();

            IEnumerable <BL.Models.Activity> activities = Mapper.Map <IEnumerable <Models.Activity>, IEnumerable <BL.Models.Activity> >(sqlActivities);

            return(activities);
        }
Пример #2
0
        public async Task <IEnumerable <BL.Models.Activity> > GetActivities([FromQuery] GetActivitiesContext activitiesContext)
        {
            var activities = await _activitiesRepository.GetActivityList(activitiesContext);

            return(activities);
        }