public async Task <PagedList <Entity> > GetBranchServiceOfferedById(BranchServiceParameters branchServiceParameters)
        {
            var getBranchServiceParameters = new object[] {
                new MySqlParameter("@p_limit", branchServiceParameters.PageSize),
                new MySqlParameter("@p_offset", (branchServiceParameters.PageNumber - 1) * branchServiceParameters.PageSize),
                new MySqlParameter("@p_Service", branchServiceParameters.ServiceId),
                new MySqlParameter("@p_Branch", branchServiceParameters.BranchId),
                new MySqlParameter("@p_IsForService", branchServiceParameters.IsForService),
                new MySqlParameter("@p_IsForBranch", branchServiceParameters.IsForBranch)
            };

            var branches = await FindAll("CALL SpSelectActiveBranchServices(@p_limit, @p_offset,@p_Service,@p_Branch," +
                                         "@p_IsForService,@p_IsForBranch)", getBranchServiceParameters).ToListAsync();

            var mappedbranches = branches.AsQueryable().ProjectTo <BranchServiceResponse>(mapper.ConfigurationProvider);
            var sortedbranches = sortHelper.ApplySort(mappedbranches, branchServiceParameters.OrderBy);
            var shapedbranches = dataShaper.ShapeData(sortedbranches, branchServiceParameters.Fields);

            return(await PagedList <Entity> .ToPagedList(shapedbranches, branchServiceParameters.PageNumber, branchServiceParameters.PageSize));
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetBranchServiceOfferedByIdQuery"/> class.
 /// </summary>
 public GetBranchServiceOfferedByIdQuery(BranchServiceParameters branchServiceParameters)
 {
     this.branchServiceParameters = branchServiceParameters;
 }