public virtual ActionResult Index(Login model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }

                IAuthenticationManager authenticationManager = HttpContext.GetOwinContext().Authentication;
                var authService          = new ApiAuthenticationService(authenticationManager);
                var authenticationResult = authService.SignIn(model.userName, model.pwd);
                if (authenticationResult.IsSuccess)
                {
                    return(Redirect("/Home"));
                }
                ModelState.AddModelError("", authenticationResult.ErrorMessage);
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", e.Message);
            }
            return(View(model));
        }
 public AuthenticationController()
 {
     this.authenticationService = new ApiAuthenticationService();
 }