Exemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] UserRegisterRequest model)
        {
            model.Role = "Admin";
            var response = await _service.Register(model);

            if (!response.IsSuccessful)
            {
                return(BadRequest(response));
            }

            var bu = Mapper.Map <UserRegisterRequest, BusinessUserModel>(model);
            await _userService.Add(bu);

            return(Ok(response));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Add([FromBody] BusinessUserModel model)
        {
            try
            {
                var response = await _service.Add(model);

                if (!response.IsSuccessful)
                {
                    return(BadRequest(response));
                }
                return(Ok(response));
            }
            catch
            {
                return(StatusCode(500, "Internal Server Error."));
            }
        }