public User Create(User user, string password)
        {
            if (string.IsNullOrWhiteSpace(password))
            {
                throw new AppException("Password is required");
            }

            if (_context.Users.Any(x => x.Username == user.Username))
            {
                throw new AppException("Username \"" + user.Username + "\" is already taken");
            }

            byte[] passwordHash, passwordSalt;
            CreatePasswordHash(password, out passwordHash, out passwordSalt);

            user.PasswordHash = passwordHash;
            user.PasswordSalt = passwordSalt;

            _context.Users.Add(user);
            _context.SaveChanges();

            return(user);
        }
        public void Post([FromBody] Review review)
        {
            review.UserId = int.Parse(User.Identity.Name);
            _db.Reviews.Add(review);
            _db.SaveChanges();
            var thisDestination = _db.Destinations.Include(destination => destination.Reviews).FirstOrDefault(destination => destination.DestinationId == review.DestinationId);

            thisDestination.GetReviewNumber();
            thisDestination.GetReviewAverage();
            _db.Entry(thisDestination).State = EntityState.Modified;
            _db.SaveChanges();
        }
 public void Post([FromBody] Destination destination)
 {
     destination.UserId = int.Parse(User.Identity.Name);
     _db.Destinations.Add(destination);
     _db.SaveChanges();
 }