/// <summary>
        /// get subscribers by page
        /// </summary>
        /// <param name="skip"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public async Task <SubscribersResponse> GetSubscribers(int?skip = 0, int?count = 10)  //зачем nullable?
        {
            var result = new SubscribersResponse();

            count.LimitCount();

            result.Count = await _context.Subscribers.CountAsync();

            result.Items = await _context.Subscribers.OrderByDescending(x => x.Id).Skip(skip ?? 0).Take((int)count).ToListAsync();

            return(result);
        }
Example #2
0
 /// <summary> Empty constructor. </summary>
 public Subscribers()
 {
     Request  = new SubscribersRequest();
     Response = new SubscribersResponse();
 }
Example #3
0
 /// <summary> Setter constructor. </summary>
 public Subscribers(SubscribersRequest request)
 {
     Request  = request;
     Response = new SubscribersResponse();
 }
 public static List <Subscribers> GetSubscribersWithMagazineIds(SubscribersResponse response)
 {
     return(response.Data.Select(x => new Subscribers {
         Id = x.Id, MagazineIds = x.MagazineIds
     }).ToList());
 }