public void CreateDraftAsync(CodePassio_Core.Entities.Post post) { post.Status = (byte)PostStatus.Draft; post.ModifiedDate = DateTime.Now; this._context.Posts.Add(post); this._context.Entry(post).State = Microsoft.EntityFrameworkCore.EntityState.Added; this._context.SaveChanges(); }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } Post = await _context.Posts .Include(p => p.Category).FirstOrDefaultAsync(m => m.Id == id); if (Post == null) { return(NotFound()); } return(Page()); }