예제 #1
0
        public void CreateUser()
        {
            var newUser = new UserAccount()
            {
                UserName = "******", Password = "******"
            };

            manger.AddUser("Nasar3", "helloworld123");
            var table  = Sql.SelectQuery("select * from getuser(@UserName)", newUser);
            var result = ObjectConverter.ConvertDataTableRowToObject <UserAccount>(table, 0);

            Assert.AreEqual("Nasar3", result.UserName);
        }
예제 #2
0
        public async Task <IActionResult> AddUser([FromBody] RegisterViewModel user)
        {
            if (user == null)
            {
                return(BadRequest("Invalid model or role Info"));
            }

            if (string.IsNullOrEmpty(user.Email) || string.IsNullOrEmpty(user.Password) || string.IsNullOrEmpty(user.Name))
            {
                return(BadRequest("Invalid model data"));
            }

            return(Ok(await AccountManager.AddUser(user)));
        }