public IActionResult Create([FromBody] CreateUserDto item) { if (item == null) { throw new ArgumentException("Invalid new user"); } try { _userService.CreateUser(item); } catch (Exception ex) { return HttpBadRequest(ex.Message); } // user created succefuly, return new empty model var createUser = new CreateUserDto(); return Ok(createUser); }
public IActionResult Create() { var createUser = new CreateUserDto(); return View(createUser); }
public void CreateUser(CreateUserDto createUserDto) { var operation = _serviceProvider.GetRequiredService<CreateUserOperation>(); operation.Operate(createUserDto); }