public async Task <IActionResult> PutUser([FromRoute] long id, [FromBody] User user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != user.UserId)
            {
                return(BadRequest());
            }

            await _userData.AddOrUpdateUser(user);

            return(NoContent());
        }
Example #2
0
        public async Task <IHttpActionResult> Register(User user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            user.Password = _cryptoService.CryptPassword(user.Password);
            var id = await _userRepo.AddOrUpdateUser(user);

            return(Ok(id));
        }