public async Task <IActionResult> GetAllPosts() { try { var allPosts = await _postServices.GetAllPosts(); if (allPosts != null) { return(Ok(allPosts)); } return(BadRequest("Sorry!, No Data was fetched, Please try again")); } catch (Exception ex) { return(BadRequest($"{ex.Message}, Error! Your task failed, Please try again")); } }
public IActionResult SingleProject(int id) { SingleProjectMV singleproject = new SingleProjectMV { Project = _projectservices.FindProjectById(id), Posts = _postservices.GetAllPosts(id), Pledges = _pledgesservices.GetPledgesByProjectId(id), PledgeUsers = _pledgesservices.GetUsersPledges(id), ProjectMultimedia = _multimediaServices.GetMultimediaOfProject(id), BackedPledges = _pledgesservices.GetUserBackedPledges().ToList(), }; if (singleproject != null) { return(View(singleproject)); } return(NotFound()); }
// GET ALL POSTS public List <Post> Get() { return(_postService.GetAllPosts()); }