public IActionResult submit(review Review) { _context.users.Add(Review); _context.SaveChanges(); return(RedirectToAction("reviews")); }
public IActionResult AddReview(Review newreview) { if (ModelState.IsValid) { _context.Add(newreview); _context.SaveChanges(); List <Review> AllReviews = _context.reviews.OrderByDescending(a => a.VisitDate).ToList(); ViewBag.allreviews = AllReviews; return(View("Index")); } return(View("New")); }
public IActionResult Create(Review model) { if (ModelState.IsValid) { Review newReview = new Review { ReviewerName = model.ReviewerName, RestaurantName = model.RestaurantName, Comment = model.Comment, Rating = model.Rating, Visited = model.Visited, CreatedAt = DateTime.Now, UpdatedAt = DateTime.Now }; _restContext.Add(newReview); _restContext.SaveChanges(); return(RedirectToAction("Reviews")); } return(View("Index")); }
public IActionResult Create(Review review) { if (!ModelState.IsValid) { return(View("Index")); } else { Review NewReview = new Review { ReviewerName = review.ReviewerName, RestName = review.RestName, RestReview = review.RestReview, VisitDate = review.VisitDate, Rating = review.Rating }; _context.Add(NewReview); _context.SaveChanges(); return(RedirectToAction("Show")); } }
public User Register(RegisterDto register) { var userId = Guid.NewGuid().ToString(); var user = new User { Id = userId, Name = register.Name }; _context.Users.Add(user); _context.Credentials.Add(new Credentials { Id = Guid.NewGuid().ToString(), UserId = userId, Email = register.Email, Password = register.Password }); _context.SaveChanges(); user.Credentials = null; return(user); }
public void Post([FromBody] Creds entity) { entity.Key = Helper.OneWayHash(entity.Key); _RESTContext.Add(entity); _RESTContext.SaveChanges(); }
public IActionResult AddRev(Review rev) { _context.Add(rev); _context.SaveChanges(); return(RedirectToAction("Reviews")); }
public void SaveChanges() { _Context.SaveChanges(); }