public async Task<IActionResult> Create([Bind("CommentId,Content,DateOfComment")] Comment comment) { if (ModelState.IsValid) { _context.Add(comment); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } return View(comment); }
public async Task <IActionResult> Create([Bind("UserInfoID,Name,Username,ProfilPictureUrl,NumberOfPosts,NumberOfComments,RegisterDate")] UserInfo userInfo) { if (ModelState.IsValid) { _context.Add(userInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(userInfo)); }
public async Task <IActionResult> Create([Bind("PostId,Title,Content,ImageUrl,DateOfPost,PostingUserID")] Post post) { if (ModelState.IsValid) { _context.Add(post); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PostingUserID"] = new SelectList(_context.UserInfo, "UserInfoID", "UserInfoID", post.PostingUserID); return(View(post)); }