Esempio n. 1
0
        public int Login(LoginModel loginModel, out Lib.BResult result)
        {
            result = new BResult();

            var user = _userProfileRepo.Get().Where(x => x.UserName.Equals(loginModel.UserName, StringComparison.CurrentCultureIgnoreCase));
            if (user == null || user.Count() != 1)
            {
                result.AddError("error", "not found");
                return -1;
            }
            else
            {
                return user.First().Id;
            }
        }
Esempio n. 2
0
        public ActionResult About()
        {
            BResult result;

            LoginModel loginModel = new LoginModel();
            loginModel.UserName = "******";
            loginModel.Password = "******";

            _security.Login(loginModel, out result);

            if (result.IsValid)
            {
                ViewBag.Message = "Success";
            }
            else
            {
                ViewBag.Message = "Failed";
            }

            return View();
        }