// Increase agree value public async Task <IActionResult> AgreeIncrease(int id, [Bind("Id,Date,Name,Heading,Comment,Restaurant,Rating,Agree,Disagree")] Rest_reviews rest_reviews) { if (id != rest_reviews.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rest_reviews); rest_reviews.Agree = rest_reviews.Agree + 1; /* rest_reviews.IsClicked = true; */ await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Rest_reviewsExists(rest_reviews.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(rest_reviews)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Date,Name,Heading,Comment,Restaurant,Rating")] Rest_reviews rest_reviews) { if (id != rest_reviews.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rest_reviews); rest_reviews.Date = DateTime.Now; rest_reviews.Name = User.Identity.Name; await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Rest_reviewsExists(rest_reviews.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(rest_reviews)); }
public async Task <IActionResult> Create([Bind("Id,Date,Name,Heading,Comment,Restaurant,Rating")] Rest_reviews rest_reviews) { if (ModelState.IsValid) { _context.Add(rest_reviews); rest_reviews.Date = DateTime.Now; rest_reviews.Agree = 0; rest_reviews.Disagree = 0; await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(rest_reviews)); }