public User Login(string userName) { User user = _userRepository.First(u => u.Login == userName || u.Email == userName); if (user != null) { CreateCookie(userName); } return(user); }
public override IEnumerable <Genre> Get(string cultureCode, params Expression <Func <Genre, object> >[] includeProperties) { var genres = base.Get(cultureCode, includeProperties).ToList(); foreach (var genre in genres) { LocalizationProvider.Localize(genre, cultureCode); if (genre.ParentGenreId != null) { genre.ParentGenreName = LocalizationProvider.Localize(_genreRepository.First(g => g.Id == genre.ParentGenreId), cultureCode).Name; } } return(genres); }
private void Init(string name, IGenericDataRepository <UserEntity, User> userRepository) { if (!string.IsNullOrEmpty(name)) { User = userRepository.First(u => u.Login == name || u.Id == name || u.Email == name); } }
public virtual TDomain First(Expression <Func <TDomain, bool> > filter, string cultureCode) { var item = _genericRepository.First(filter); LocalizationProvider.Localize(item, cultureCode); return(item); }
public Publisher GetPublisherByCompanyName(string companyName, string cultureCode) { var company = _publisherRepository.First(x => x.CompanyName == companyName); LocalizationProvider.Localize(company, cultureCode); return(company); }
public string Login(string userName, string password, bool isPersistent) { var hashedPassword = _generator.Generate(password); var user = _userRepository.First(u => (u.Login == userName || u.Email == userName) && u.Password == password); if (user == null) { return(null); } User = new UserProvider(userName, _userRepository); var encryptedTicket = CreateTicket(user.Id, isPersistent); return(encryptedTicket); }
public virtual TDomain First(Expression <Func <TDomain, bool> > filter) { var domain = SqlDataRepository.First(filter) ?? MongoDataRepository.First(filter); return(domain); }