public IActionResult Index(string filter, int page = 1, string sortExpression = "Name") { var stories = _storyService.GetAll().Select(x => new StoryDetailViewModel { Id = x.Id.ToString(), Name = x.Name, Reporter = x.Reporter, Description = x.Description, Point = x.Point }); //var model = new StoryIndexViewModel //{ // Stories = stories //}; //return View(model); if (!string.IsNullOrWhiteSpace(filter)) { stories = stories.Where(p => p.Name.Contains(filter)); } var model = PagingList.Create(stories, 5, page, sortExpression, "Name"); model.RouteValue = new RouteValueDictionary { { "filter", filter } }; return(View(model)); }
public IHttpActionResult Get() { return(Ok(_storyService.GetAll().Select(story => new StoryViewModel { Name = story.Name, Teller = story.Teller.FirstName + " " + story.Teller.LastName }))); }
public IActionResult List() { var model = _storyService.GetAll(); return(View(model)); }
public async Task <IEnumerable <Article> > GetItemsAsync(bool forceRefresh = false) { return(await _storyService.GetAll()); }
public IActionResult GetAll() { var stories = _storyService.GetAll(); return Ok(stories); }