public IActionResult GetV1([FromBody] DataStateV1 state) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var result = new DataStateV1Result <RoleV1> { Data = map.Map <IEnumerable <RoleV1> >( uow.Roles.Get( map.MapExpression <Expression <Func <IQueryable <tbl_Role>, IQueryable <tbl_Role> > > >( QueryExpressionFactory.GetQueryExpression <tbl_Role>().ApplyState(state)), new List <Expression <Func <tbl_Role, object> > >() { x => x.tbl_AudienceRoles, x => x.tbl_UserRoles, })), Total = uow.Roles.Count( map.MapExpression <Expression <Func <IQueryable <tbl_Role>, IQueryable <tbl_Role> > > >( QueryExpressionFactory.GetQueryExpression <tbl_Role>().ApplyPredicate(state))) }; return(Ok(result)); } catch (QueryExpressionException ex) { ModelState.AddModelError(MessageType.ParseError.ToString(), ex.ToString()); return(BadRequest(ModelState)); } }
public IActionResult GetTextsV1([FromBody] DataStateV1 state) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var result = new DataStateV1Result <EmailV1> { Data = map.Map <IEnumerable <EmailV1> >( uow.Audiences.Get( map.MapExpression <Expression <Func <IQueryable <uvw_TextQueue>, IQueryable <uvw_TextQueue> > > >( QueryExpressionFactory.GetQueryExpression <uvw_TextQueue>().ApplyState(state)))), Total = uow.Audiences.Count( map.MapExpression <Expression <Func <IQueryable <uvw_TextQueue>, IQueryable <uvw_TextQueue> > > >( QueryExpressionFactory.GetQueryExpression <uvw_TextQueue>().ApplyPredicate(state))) }; return(Ok(result)); } catch (QueryExpressionException ex) { ModelState.AddModelError(MessageType.ParseError.ToString(), ex.ToString()); return(BadRequest(ModelState)); } }
public async ValueTask <HttpResponseMessage> User_GetV1(string jwt, DataStateV1 model) { _http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", jwt); return(await _http.PostAsync("user/v1/page", new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json"))); }
public async ValueTask <DataStateV1Result <UserV1> > User_GetV1(DataStateV1 model) { var response = await Endpoints.User_GetV1(Grant.AccessToken.RawData, model); if (response.IsSuccessStatusCode) { return(await response.Content.ReadAsAsync <DataStateV1Result <UserV1> >()); } throw new HttpRequestException(response.RequestMessage.ToString(), new Exception(response.ToString())); }