コード例 #1
0
        public IActionResult submit(review Review)
        {
            _context.users.Add(Review);
            _context.SaveChanges();



            return(RedirectToAction("reviews"));
        }
コード例 #2
0
 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"));
 }
コード例 #3
0
 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"));
 }
コード例 #4
0
        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"));
            }
        }
コード例 #5
0
ファイル: AuthService.cs プロジェクト: Rardd1997/web-api-core
        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);
        }
コード例 #6
0
 public void Post([FromBody] Creds entity)
 {
     entity.Key = Helper.OneWayHash(entity.Key);
     _RESTContext.Add(entity);
     _RESTContext.SaveChanges();
 }
コード例 #7
0
 public IActionResult AddRev(Review rev)
 {
     _context.Add(rev);
     _context.SaveChanges();
     return(RedirectToAction("Reviews"));
 }
コード例 #8
0
 public void SaveChanges()
 {
     _Context.SaveChanges();
 }