//[ValidateAntiForgeryToken] public async Task <IActionResult> Create([Bind("Id,Name,Content,AuthorEmail")] BlogPost blogPost) { if (ModelState.IsValid) { _context.Add(blogPost); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(blogPost)); }
public async Task <IActionResult> Create([Bind("AuthorId,GivenName,Surname,Email")] Author author) { if (ModelState.IsValid) { _context.Add(author); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(author)); }
public async Task <IActionResult> Create([Bind("UserId,RealName,Alias,Birthday")] User user) { if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Create([Bind("SocialId,Website,SocialMediaURL,ActiveSince,UserId")] Social social) { if (ModelState.IsValid) { _context.Add(social); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.User, "UserId", "UserId", social.UserId); return(View(social)); }
public async Task <IActionResult> Create([Bind("BlogId,BlogTitle,BlogUrl,BlogDescription,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)); }
public async Task <IActionResult> Create([Bind("PostId,PostTitle,PostContent,BlogId")] Post post) { if (ModelState.IsValid) { _context.Add(post); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BlogId"] = new SelectList(_context.Blog, "BlogId", "BlogId", post.BlogId); return(View(post)); }