using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sevomin.Models.Repositories { public class UserRepository : IUserRepository { #region Singleton private static UserRepository member; private static object locker = new object(); private UserRepository() { } static UserRepository() { lock (locker) { UserRepository.member = new UserRepository(); } } public static UserRepository Current { get { return UserRepository.member; } } #endregion public User FindWithConfirmationCode(string code) { return SevominDbContext.Current.Users.FirstOrDefault(u => u.ConfirmationCode == code); } public void Add(User entity) { throw new NotImplementedException(); } public User Find(string identifier) { return SevominDbContext.Current.Users.FirstOrDefault(u => u.UserName.ToLower() == identifier.ToLower()); } public void Delete(User entity) { throw new NotImplementedException(); } public void Save() { SevominDbContext.Current.SaveChanges(); } } }