예제 #1
0
        public void TestLogin()
        {
            var loginModel = new LoginModel()
            {
                Login    = "******",
                Password = "******"
            };
            var result = bll.Login(loginModel);

            Assert.AreNotEqual(null, result);
            loginModel = new LoginModel()
            {
                Login    = "******",
                Password = "******"
            };
            result = bll.Login(loginModel);
            Assert.AreEqual(null, result);
        }
예제 #2
0
        public IHttpActionResult Login([FromBody] LoginModel loginModel)
        {
            if (string.IsNullOrEmpty(loginModel.Login) || string.IsNullOrEmpty(loginModel.Password))
            {
                return(BadRequest());
            }
            var result = _bll.Login(loginModel);

            if (result != null)
            {
                return(Ok(result));
            }
            return(Unauthorized());
        }