public ServiceProviderWraper GetServiceProviders(int PageNo, int TotalCount) { ServiceProviderWraper serviceProviderWraper = new ServiceProviderWraper() { serviceProviderViewModelList = (from u in AutoSolutionContext.User join ur in AutoSolutionContext.UserRoles on u.UserId equals ur.UserId //join r in AutoSolutionContext.Roles //on ur.RolesId equals r.RolesId where ur.RolesId == 6 orderby u.UserId select new ServiceProviderViewModel() { First_Name = u.FirstName, Last_Name = u.LastName, Email = u.Email, MobileNumber = u.MobileNumber, PhoneNumber = u.PhoneNumber, SelectedCity = u.Cities.CityName, Address = u.Address, BusinessDescription = u.BusinessDescription, ImagePath = u.ImagePath, IsActive = u.IsActive, serviceCategoriesListFor = AutoSolutionContext.UserServiceCatogories.Where(x => x.UserId == u.UserId).Select(x => new ServiceCategoryViewModel { ServiceCategoryName = x.ServiceCategory.ServiceCategoryName }).ToList() } ).Skip((PageNo - 1) * 10).Take(10).ToList(), Pager = new Pager(TotalCount, PageNo, 10) }; return(serviceProviderWraper); }
public ActionResult GetServiceProvider(string search, int?pageNo) { try { if (string.IsNullOrEmpty(search)) { int PageNo = pageNo.HasValue ? pageNo.Value > 0 ? pageNo.Value : 1 : 1; int TotalCount = _unitOfWork.User.GetServiceProvidersCount(); ServiceProviderWraper model = _unitOfWork.User.GetServiceProviders(PageNo, TotalCount); return(PartialView("_GetServiceProvider", model)); } //else //{ // int PageNo = pageNo.HasValue ? pageNo.Value > 0 ? pageNo.Value : 1 : 1; // int TotalCount = _unitOfWork.PartsProductsCategory.GetPartsProductsCategoryCount(search); // var model = _unitOfWork.PartsProductsCategory.GetPartsProductsCategory(PageNo, TotalCount, search); // return PartialView("_GetPartsProductsCategory", model); //} } catch (Exception) { throw; } return(PartialView("_GetServiceProvider")); }