public async Task <IActionResult> Create([Bind(" ID, UserID, TrailID, UserComment")] UserComments userComments) { if (ModelState.IsValid) { _context.Add(userComments); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(userComments)); }
/// <summary> /// Adds a user to the DB /// </summary> /// <param name="user"> Identifies the user in relation to UserInfo </param> /// <returns></returns> public async Task AddUser(UserInfo user) { await _context.AddAsync(user); await _context.SaveChangesAsync(); }
public async Task AddComment(UserComments userComment) { await _context.UserComments.AddAsync(userComment); await _context.SaveChangesAsync(); }