2015-04-15 23:57:36 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
2015-04-27 00:10:02 +08:00
|
|
|
|
using System.Web.Helpers;
|
2015-04-15 23:57:36 +08:00
|
|
|
|
using System.Web.Mvc;
|
2015-04-27 00:10:02 +08:00
|
|
|
|
using OpenAuth.App;
|
|
|
|
|
using OpenAuth.App.DTO;
|
|
|
|
|
using OpenAuth.Infrastructure.Repository;
|
2015-04-15 23:57:36 +08:00
|
|
|
|
|
|
|
|
|
namespace OpenAuth.Web.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// GET: /Home/
|
|
|
|
|
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-27 00:10:02 +08:00
|
|
|
|
public ActionResult Login()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ContentResult Login(string username, string password)
|
|
|
|
|
{
|
|
|
|
|
var request = new LoginRequest {UserName = username, Password = password};
|
|
|
|
|
var loginApp = new LoginApp(new UserRepository());
|
|
|
|
|
var response = loginApp.Login(request);
|
|
|
|
|
if(response.Success)
|
|
|
|
|
Response.Redirect("Home/Index");
|
|
|
|
|
return Content(response.Message);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-15 23:57:36 +08:00
|
|
|
|
}
|
|
|
|
|
}
|