Beispiel #1
0
        public async Task <IActionResult> AddUser(DTOUser user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("incorrect model state"));
            }

            user.Name = user.Name.ToLower();

            var userToStore = new User
            {
                Name           = user.Name,
                PassportNumber = user.PassportNumber,
                IdentityNumber = user.IdentityNumber,
                Active         = true
            };

            var created = await _helper.AddUserAsync(userToStore);

            return(Created("Created successfully", created));
        }