Example #1
0
        public async Task <IActionResult> CreateUser([FromBody] CreateUserModel model)
        {
            #region Validate Model

            //var userInputValidated = _userModelValidator.Validate(model);

            //if (!userInputValidated.IsValid)
            //    return BadRequest(new {
            //        Succeeded = false,
            //        Message = _badRequest.ShowError(int.Parse(userInputValidated.Errors[0].ErrorMessage))
            //    });

            #endregion

            var createdUser = await _user.CreateUser(model);

            return(Ok(createdUser));
        }
Example #2
0
        public async Task <IActionResult> CreateUser([FromBody] CreateUserModel model)
        {
            #region Validate Model

            var userInputValidated = _userModelValidator.Validate(model);

            if (!userInputValidated.IsValid)
            {
                _infos.Add(_badRequest.ShowError(int.Parse(userInputValidated.Errors[0].ErrorMessage)).Message);

                return(BadRequest(new CustomResponse <string> {
                    Message = _infos
                }));
            }

            #endregion

            var createdUser = await _user.CreateUser(model);

            return(Ok(createdUser));
        }