//get publicposts public ActionResult PublicJournalEntries(PublicOrPrivate publicPost) { var service = new PublicPostServices(); var model = service.GetPublicPosts(publicPost); return(View(model)); }
public ActionResult PublicJournalEntries(PublicOrPrivate publicPost) { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new ReplyServices(userId); var model = service.GetPublicPosts(publicPost); return(View(model)); }
public IEnumerable <JournalEntryListItem> GetPublicPosts(PublicOrPrivate publicPost) { using (var ctx = new ApplicationDbContext()) { var query = ctx .JournalEntries .Where(x => x.PublicOrPrivate == publicPost) .Select( x => new JournalEntryListItem { Tag = x.Tag, Prompt = x.PromptItem.Prompt, Content = x.Content, PhotoUrl = x.PhotoUrl, CreatedUtc = x.CreatedUtc } ); return(query.ToArray()); } }