2015-04-25 12:31:01 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using OpenAuth.Domain.Interface;
|
|
|
|
|
using OpenAuth.Domain.Model;
|
|
|
|
|
|
2015-05-24 23:23:26 +08:00
|
|
|
|
namespace OpenAuth.Repository
|
2015-04-25 12:31:01 +08:00
|
|
|
|
{
|
|
|
|
|
public class UserRepository :BaseRepository, IUserRepository
|
|
|
|
|
{
|
2015-05-22 17:45:18 +08:00
|
|
|
|
public User FindByAccount(string username)
|
2015-04-25 12:31:01 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return _Context.Users.First(e => e.Account == username);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-05-22 17:45:18 +08:00
|
|
|
|
|
|
|
|
|
public User FindById(string id)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return _Context.Users.First(e => e.Id == id);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-25 12:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|