add login service

This commit is contained in:
yubaolee
2015-04-25 12:31:01 +08:00
parent 7707c6a1e2
commit 370b390c7c
28 changed files with 236 additions and 16 deletions

View File

@@ -0,0 +1,9 @@
using OpenAuth.Domain.Model;
namespace OpenAuth.Domain.Interface
{
public interface IUserRepository
{
User FindBy(string username);
}
}

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
namespace OpenAuth.Domain.Model
{
public partial class Button
{

View File

@@ -1,4 +1,4 @@
namespace OpenAuth.Domain
namespace OpenAuth.Domain.Model
{
public partial class DataPermission
{

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
namespace OpenAuth.Domain.Model
{
public partial class Department
{

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
namespace OpenAuth.Domain.Model
{
public partial class Menu
{

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
namespace OpenAuth.Domain.Model
{
public partial class Role
{

View File

@@ -1,4 +1,4 @@
namespace OpenAuth.Domain
namespace OpenAuth.Domain.Model
{
public partial class RoleMenuButton
{

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
namespace OpenAuth.Domain.Model
{
public partial class User
{
@@ -16,9 +16,10 @@ namespace OpenAuth.Domain
public string Password { get; set; }
public string RealName { get; set; }
public string RoleId { get; set; }
public Nullable<int> Enabled { get; set; }
public Nullable<int> DeleteMark { get; set; }
public bool Enabled { get; set; }
public bool DeleteMark { get; set; }
public virtual ICollection<Department> Departments { get; set; }
public virtual ICollection<Role> Roles { get; set; }
}
}

View File

@@ -39,15 +39,18 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Button.cs" />
<Compile Include="DataPermission.cs" />
<Compile Include="Department.cs" />
<Compile Include="Menu.cs" />
<Compile Include="Interface\IUserRepository.cs" />
<Compile Include="Model\Button.cs" />
<Compile Include="Model\DataPermission.cs" />
<Compile Include="Model\Department.cs" />
<Compile Include="Model\Menu.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Role.cs" />
<Compile Include="RoleMenuButton.cs" />
<Compile Include="User.cs" />
<Compile Include="Model\Role.cs" />
<Compile Include="Model\RoleMenuButton.cs" />
<Compile Include="Model\User.cs" />
<Compile Include="Service\LoginService.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenAuth.Domain.Interface;
using OpenAuth.Domain.Model;
namespace OpenAuth.Domain.Service
{
public class LoginService
{
private IUserRepository _userRepository;
public LoginService(IUserRepository repository)
{
_userRepository = repository;
}
public User Login(string username, string password)
{
return _userRepository.FindBy(username);
}
}
}