Ejemplo n.º 1
0
        public async Task <IActionResult> PostMembers([FromBody] MembersRequest request)
        {
            if (request.Index == null)
            {
                Response.StatusCode = 400;
                return(new JsonResult("Index property is missing."));
            }
            if (request.Type == RequestType.Members)
            {
                try
                {
                    var response = await GetMembers(request.Index, request.Page, request.Field);

                    return(Content(response, "application/json"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.StackTrace);
                    Response.StatusCode = 500;
                    return(new JsonResult(e.Message));
                }
            }
            Response.StatusCode = 400;
            return(Content("Incorrect request for this endpoint."));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PostMembers([FromBody] MembersRequest request)
        {
            var response = await _apiService.GetMembersAsync(request, GetServerFilter());

            return(new JsonResult(response));
        }