public async Task <IActionResult> Edit(int id, [Bind("blogId,blogTitle,imagePath,blogDescription,blogDateTime,isPublished")] myBlog myBlog) { if (id != myBlog.blogId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(myBlog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!myBlogExists(myBlog.blogId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(myBlog)); }
public async Task <IActionResult> Create([Bind("blogId,blogTitle,imagePath,blogDescription,blogDateTime,isPublished")] myBlog myBlog) { if (ModelState.IsValid) { _context.Add(myBlog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(myBlog)); }