public async Task <IActionResult> Post([FromBody] SearchCommand value) { if (value == null) { return(BadRequest("The supplied request is invalid")); } // var searchObject = Newtonsoft.Json.JsonConvert.DeserializeObject(value); return(Ok(await _recallRepository.RetrieveRecall(value))); }
public async Task <IActionResult> Get(HttpRequestMessage req) { var recalls = await _recallRepository.RetrieveRecall( new SearchCommand() { Data = new SearchCommand.Params() { RecallDateStart = DateTime.Now.AddMonths(-6).ToString("yyyy-MM-dd") } } ); var limit = 7; HttpResponseMessage resp = new HttpResponseMessage(HttpStatusCode.OK); resp.Headers.Add("count", recalls.Count.ToString()); return(Ok(new { resultCount = limit, recalls = recalls.Take(limit).ToList() })); }