public IActionResult SaveUser(UserViewModel viewModel) { if (viewModel == null || !_unitOfWork.User.IsValid(viewModel)) { return(BadRequest()); } var user = new User { Name = viewModel.Name, LastName = viewModel.LastName, Email = viewModel.Email, City = viewModel.City, Password = _utilities.EncryptPassword(viewModel.Password), Phone = viewModel.Phone, }; _unitOfWork.User.AddUser(user); _unitOfWork.Complete(); return(Ok(user)); }