Exemple #1
0
        public async Task SubscribeToRequest(int requestId, RequestType type)
        {
            var user = await GetUser();

            var existingSub = await _subscriptionRepository.GetAll().FirstOrDefaultAsync(x =>
                                                                                         x.UserId.Equals(user.Id) && x.RequestId == requestId && x.RequestType == type);

            if (existingSub != null)
            {
                return;
            }
            var sub = new RequestSubscription
            {
                UserId      = user.Id,
                RequestId   = requestId,
                RequestType = type
            };

            await _subscriptionRepository.Add(sub);
        }
Exemple #2
0
        protected IQueryable <OmbiUser> GetSubscriptions(int requestId, RequestType type)
        {
            var subs = RequestSubscription.GetAll().Include(x => x.User).Where(x => x.RequestId == requestId && type == x.RequestType);

            return(subs.Select(x => x.User));
        }