OpenAuth.Net/OpenAuth.Web/Controllers/AccountController.cs
2015-05-23 12:10:53 +08:00

31 lines
805 B
C#

using System.Web.Mvc;
using OpenAuth.App;
using OpenAuth.App.DTO;
using OpenAuth.Domain.Service;
using OpenAuth.Repository.Repository;
namespace OpenAuth.Web.Controllers
{
public class AccountController : Controller
{
//
// GET: /Account/
public ActionResult Login()
{
return View();
}
[HttpPost]
public ActionResult Login(string username, string password)
{
var request = new LoginRequest { UserName = username, Password = password };
var loginApp = new LoginApp(new LoginService(new UserRepository()));
var response = loginApp.Login(request);
LoginCacheApp.SetLogin(response);
return Json(new { response.Success, response.Message });
}
}
}