public IActionResult RemoveStartupComments(int id) { UserStartup specificStartup = _context.UserStartup.Find(id); StartupComments userStartupComment = _context.StartupComments.Find(id); if (ModelState.IsValid) { _context.StartupComments.Remove(userStartupComment); _context.SaveChanges(); return(RedirectToAction("UserFavorites")); } else { return(RedirectToAction("DisplaySeamlessStartups")); } }
public IActionResult AddStartupRating(int id, int rating) { StartupComments startupComment = new StartupComments(); startupComment.StartupId = id; startupComment.Rating = rating; startupComment.UserId = User.FindFirstValue(ClaimTypes.NameIdentifier); if (ModelState.IsValid) { _context.StartupComments.Update(startupComment); _context.SaveChanges(); return(RedirectToAction("StartupDetails", new { id = id })); } else { return(RedirectToAction("AddStartupRating")); } }