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); }
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()); }