public ActionResult New(Credentials credentials)
        {
            Contract.Requires<ArgumentNullException>(credentials != null);

            CheckModelState(() =>
            {
                this.Flash("danger", "Both a username and password are required.");
                return View("New", credentials);
            });

            var logonResult = mediator.Send(credentials.ToCommand());
            if (logonResult.IsSuccessful)
            {
                SessionAdapter.SetUpSession(logonResult.User);
                this.Flash("success", string.Format("Welcome back, {0}", logonResult.User.Username));
                return RedirectToAction("Index", "Tasks");
            }
            else
            {
                this.Flash("danger", "Invalid credentials");
                return View("New", credentials);
            }
        }
 public ActionResult New()
 {
     var credentials = new Credentials();
     return View("New", credentials);
 }