public async Task <IActionResult> Create([Bind("AuthorId,Name,Email,Phone")] Author author) { if (ModelState.IsValid) { _context.Add(author); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(author)); }
public async Task <IActionResult> Create([Bind("BlogID,Title,Created,LastModified,Post,AuthorId")] Blog blog) { if (ModelState.IsValid) { _context.Add(blog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AuthorId"] = new SelectList(_context.Author, "AuthorId", "AuthorId", blog.AuthorId); return(View(blog)); }