public async Task <IHttpActionResult> GetAllRequests(RequestStatusViewModel model) { try { var request = await _UnitOfWork.RequestRepository.Filter(x => (x.Status == (RequestStatusEnum)model.Status || model.Status == null) && (x.Type == (RequestTypeEnum)model.Type || model.Type == null)) .OrderBy(x => x.Id).Skip(model.PageSize * model.PageNumber) .Take(model.PageSize).ToListAsync(); return(Ok(request)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IHttpActionResult> GetUserAllRequests(RequestStatusViewModel model) { try { var request = await _UnitOfWork.RequestRepository.Filter(x => (x.Status == RequestStatusEnum.New || x.Status == RequestStatusEnum.Inprogress)) .OrderBy(x => x.Id).Skip(model.PageSize * model.PageNumber) .Take(model.PageSize).ToListAsync(); return(Ok(request)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IHttpActionResult> GetAgentAllRequest(RequestStatusViewModel model) { try { string userName = User.Identity.GetUserName(); ApplicationUser u = await GetApplicationUser(userName); var status = model.Status != null ? (RequestStatusEnum)model.Status : 0; // var type = model.Type != null ? (RequestTypeEnum)model.Type : 0; var type = RequestTypeEnum.Request; var request = _UnitOfWork.RequestRepository.GetAllAgentRequest(status, type, model.PageSize, model.PageNumber, u.CityId.Value, u.Id); return(Ok(request)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public RequestStatusPage() { Title = "Solicitudes realizadas"; InitializeComponent(); BindingContext = viewModel = new RequestStatusViewModel(); }