mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-09 19:04:44 +08:00
add login service
This commit is contained in:
9
OpenAuth.Domain/Interface/IUserRepository.cs
Normal file
9
OpenAuth.Domain/Interface/IUserRepository.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using OpenAuth.Domain.Model;
|
||||
|
||||
namespace OpenAuth.Domain.Interface
|
||||
{
|
||||
public interface IUserRepository
|
||||
{
|
||||
User FindBy(string username);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenAuth.Domain
|
||||
namespace OpenAuth.Domain.Model
|
||||
{
|
||||
public partial class Button
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace OpenAuth.Domain
|
||||
namespace OpenAuth.Domain.Model
|
||||
{
|
||||
public partial class DataPermission
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenAuth.Domain
|
||||
namespace OpenAuth.Domain.Model
|
||||
{
|
||||
public partial class Department
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenAuth.Domain
|
||||
namespace OpenAuth.Domain.Model
|
||||
{
|
||||
public partial class Menu
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenAuth.Domain
|
||||
namespace OpenAuth.Domain.Model
|
||||
{
|
||||
public partial class Role
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace OpenAuth.Domain
|
||||
namespace OpenAuth.Domain.Model
|
||||
{
|
||||
public partial class RoleMenuButton
|
||||
{
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
26
OpenAuth.Domain/Service/LoginService.cs
Normal file
26
OpenAuth.Domain/Service/LoginService.cs
Normal 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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user