public ActionResult _LoadProduct(SearchDealModel model) { model.PageIndex = model.PageIndex == 0 ? 1 : model.PageIndex; var query = _dealRepository.GetDealList(); if (!string.IsNullOrEmpty(model.DealType)) { } if (!string.IsNullOrEmpty(model.Sort)) { } if (!string.IsNullOrEmpty(model.Search)) { query = query.Where(x => x.ProductName.Contains(model.Search)); } model.TotalRecordCount = query.Count(); var _getList = query.OrderBy(a => a.DealId).Skip(((model.PageIndex - 1) * model.PageSize)).Take(model.PageSize).ToList(); int pageCount = (model.TotalRecordCount / model.PageSize) + ((model.TotalRecordCount % model.PageSize) > 0 ? 1 : 0); model.TotalPageCount = pageCount; // bind schemes foreach (var item in _getList) { item.lstSchemes = _schemeRepository.FindBy(x => x.DealId == item.DealId).ToList(); } model.getDealModels = _getList; return(PartialView(model)); }
public ActionResult GetDealList(int Id) { List <GetDealModel> models = new List <GetDealModel>(); string ListStatus = string.Empty; if (Id == (int)Status.Active) { ListStatus = "APPROVED"; models = _dealRepository.GetDealList().Where(x => x.Status == (int)Status.Active && x.IsDeleted == false).ToList(); } else if (Id == (int)Status.Deactive) { ListStatus = "DEACTIVE"; models = _dealRepository.GetDealList().Where(x => x.Status == (int)Status.Deactive && x.IsDeleted == false).ToList(); } else { ListStatus = "UN-APPROVED"; models = _dealRepository.GetDealList().Where(x => x.Status == (int)Status.Created && x.IsDeleted == false).ToList(); } ViewBag.ListStatus = ListStatus; return(View(models)); }
public HttpResponseMessage GetDealList() { ResponseWithData <List <GetDealModel> > _response = new ResponseWithData <List <GetDealModel> >(); var _getList = _dealRepository.GetDealList().ToList(); if (_getList.Count > 0) { _response.Type = "success"; _response.Message = "success"; _response.data = _getList; return(Request.CreateResponse(HttpStatusCode.OK, _response)); } else { _response.Type = "error"; _response.Message = "No record found"; _response.data = null; return(Request.CreateResponse(HttpStatusCode.OK, _response)); } }