public ActionResult SignUp([FromBody] SignUpViewModel model) { if (ModelState.IsValid) { if (!_userBll.CheckUserUniqueness(model.Email)) { return(BadRequest(new ObjectResult(new { message = "Пользователь с таким адресом уже существует" }))); } if (!_userBll.IsSnilsUnique(model.Snils)) { return(BadRequest(new ObjectResult(new { message = "Пользователь с таким СНИЛС уже существует" }))); } Users user = new Users() { FirstName = model.FirstName, LastName = model.LastName, Patronym = model.Patronym, Email = model.Email, Sex = model.Sex, District = model.District, Password = _userBll.HashPassword(model.Password), IsBlocked = false, IsConfirmedEmail = false, Snils = model.Snils, Role = 1, DateOfBirth = model.DateOfBirth, UserAvatar = model.UserAvatar, }; _userBll.AddUser(user); _userBll.SendConfirmationEmail(model.Email); return(Ok()); } return(BadRequest()); }