private async Task <HttpResponseMessage> ExecuteGetAsync(params object[] parameters) { var city = (string)parameters[0]; var date = (string)parameters[1]; var newsId = (string)parameters[2]; await this.ValidateGetNewsOperation(city, date, newsId); NewsREST news = NewsREST.FromNewsBll(await this.repository.GetNews(city, DateTime.Parse(date), Guid.Parse(newsId)), this.Request); HttpResponseMessage response = this.Request.CreateResponse(HttpStatusCode.OK, news); return(response); }
private async Task <HttpResponseMessage> ExecuteGetAsync(params object[] parameters) { var city = (string)parameters[0]; DateTime day = DateTime.Now; await this.ValidateGetOperation(city, day); List <NewsREST> retrievedNews = (await this.repository.ListNews(city, day)).Select( news => NewsREST.FromNewsBll(news, this.Request)).Take(10).ToList(); HttpResponseMessage response = this.Request.CreateResponse(HttpStatusCode.OK, retrievedNews); return(response); }