コード例 #1
0
        public async Task <IActionResult> GetServiceSubscriptions([FromQuery] ServiceSubscriptionsParameter serviceSubscriptionsParameter)
        {
            var getAllserviceSubscriptionsQuery = new GetAllServiceSubscriptionsQuery(serviceSubscriptionsParameter);
            var result = await mediator.Send(getAllserviceSubscriptionsQuery);

            if (result.Code == HttpStatusCode.OK)
            {
                Response.Headers.Add("X-Pagination", PagedList <Entity> .ToJson(result.Value as PagedList <Entity>));
            }

            return(StatusCode((int)result.Code, result.Value));
        }
コード例 #2
0
        /// <summary>
        /// Gets all ServiceSubscriptions
        /// </summary>
        /// <param name="serviceSubscriptionsParameter">The ServiceSubscriptions parameters.</param>
        /// <returns></returns>
        //public async Task<PagedList<Entity>> GetAllServiceSubscriptions(ServiceSubscriptionsParameter serviceSubscriptionsParameter)
        //{
        //    {
        //        var getvendorSubscriptionsParams = new object[] {
        //        new MySqlParameter("@p_Limit", serviceSubscriptionsParameter.PageSize),
        //        new MySqlParameter("@p_Offset", (serviceSubscriptionsParameter.PageNumber - 1) * serviceSubscriptionsParameter.PageSize),
        //        new MySqlParameter("@p_IsForSingleServiceSubscription", serviceSubscriptionsParameter.IsForSingleServiceSubscription),
        //        new MySqlParameter("@p_IsForService", serviceSubscriptionsParameter.IsForService),
        //        new MySqlParameter("@p_IsForSubscription", serviceSubscriptionsParameter.IsForSubscription),
        //        new MySqlParameter("@p_ApprovalStatus", serviceSubscriptionsParameter.ApprovalStatus),
        //        new MySqlParameter("@p_PaymentStatus", serviceSubscriptionsParameter.PaymentStatus),
        //        new MySqlParameter("@p_Value", serviceSubscriptionsParameter.Value),
        //        new MySqlParameter("@p_FromDate", serviceSubscriptionsParameter.FromDate),
        //        new MySqlParameter("@p_ToDate", serviceSubscriptionsParameter.ToDate)
        //    };
        //        var servicesubscriptions = await FindAll("CALL SpSelectActiveServiceSubscription(@p_Limit, @p_Offset, @p_IsForSingleServiceSubscription,@p_IsForService,@p_IsForSubscription,@p_Value,@p_ApprovalStatus,@p_PaymentStatus, @p_FromDate, @p_ToDate)", getvendorSubscriptionsParams).ToListAsync();
        //        var mappedVendorSubscriptions = servicesubscriptions.AsQueryable().ProjectTo<ServiceSubscriptionsResponse>(mapper.ConfigurationProvider);
        //        var sortedVendorSubscriptions = sortHelper.ApplySort(mappedVendorSubscriptions, serviceSubscriptionsParameter.OrderBy);
        //        var shapedVendorSubscriptions = dataShaper.ShapeData(sortedVendorSubscriptions, serviceSubscriptionsParameter.Fields);

        //        return await PagedList<Entity>.ToPagedList(shapedVendorSubscriptions, serviceSubscriptionsParameter.PageNumber, serviceSubscriptionsParameter.PageSize);

        //    }
        //}

        public async Task <PagedList <Entity> > GetAllServiceSubscriptions(ServiceSubscriptionsParameter serviceSubscriptionsParameter)
        {
            var serviceSubscriptions = FindByCondition(x => x.Active == Convert.ToInt16(true)).ProjectTo <ServiceSubscriptionsResponse>(mapper.ConfigurationProvider);

            SearchByServiceSuubscriptions(ref serviceSubscriptions, serviceSubscriptionsParameter);
            var sortedServiceSubscriptions = sortHelper.ApplySort(serviceSubscriptions, serviceSubscriptionsParameter.OrderBy);

            FilterByDate(ref serviceSubscriptions, serviceSubscriptionsParameter.FromDate, serviceSubscriptionsParameter.ToDate);
            var shapedServiceSubscriptions = dataShaper.ShapeData(sortedServiceSubscriptions, serviceSubscriptionsParameter.Fields);

            return(await PagedList <Entity> .ToPagedList(shapedServiceSubscriptions, serviceSubscriptionsParameter.PageNumber, serviceSubscriptionsParameter.PageSize));
        }
コード例 #3
0
 public Task <APIResponse> GetServiceSubscriptions(ServiceSubscriptionsParameter serviceSubscriptionsParameter)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetAllServiceSubscriptionsQuery"/> class.
 /// </summary>
 /// <param name="serviceSubscriptionsParameter">The Service Subscriptions  parameters.</param>
 public GetAllServiceSubscriptionsQuery(ServiceSubscriptionsParameter serviceSubscriptionsParameter)
 {
     ServiceSubscriptionsParameter = serviceSubscriptionsParameter;
 }
コード例 #5
0
        public async Task <IActionResult> GetServiceSubscriptions([FromQuery] ServiceSubscriptionsParameter serviceSubscriptionsParameter)
        {
            var result = await serviceSubscriptionService.GetServiceSubscriptions(serviceSubscriptionsParameter);

            return(StatusCode((int)result.Code, result.Value));
        }
コード例 #6
0
 private void SearchByServiceSuubscriptions(ref IQueryable <ServiceSubscriptionsResponse> serviceSubscriptions, ServiceSubscriptionsParameter serviceSubscriptionsParameter)
 {
     if (serviceSubscriptionsParameter.IsForSingleServiceSubscription == true)
     {
         serviceSubscriptions = serviceSubscriptions.Where(x => x.Id.Equals(serviceSubscriptionsParameter.Value));
     }
     else if (serviceSubscriptionsParameter.IsForService == true)
     {
         serviceSubscriptions = serviceSubscriptions.Where(x => x.ServiceId.Equals(serviceSubscriptionsParameter.Value));
     }
     else if (serviceSubscriptionsParameter.IsForSubscription == true)
     {
         serviceSubscriptions = serviceSubscriptions.Where(x => x.Subscription < serviceSubscriptionsParameter.Value);
     }
     if (serviceSubscriptionsParameter.ApprovalStatus > 0)
     {
         serviceSubscriptions = serviceSubscriptions.Where(x => x.ApprovalStatus == serviceSubscriptionsParameter.ApprovalStatus);
     }
     if (serviceSubscriptionsParameter.PaymentStatus > 0)
     {
         serviceSubscriptions = serviceSubscriptions.Where(x => x.PaymentStatus == serviceSubscriptionsParameter.PaymentStatus);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GetVendorSubscriptionQuery"/> class.
 /// </summary>
 /// <param name="VendorSubscriptionId">The ServiceSubscriptions identifier.</param>
 public GetServiceSubscriptionofVendorQuery(ServiceSubscriptionsParameter serviceSubscriptionsParameter)
 {
     ServiceSubscriptionsParameter = serviceSubscriptionsParameter;
 }