public List<User> GetList(UserFilter filter) { if (filter == null) throw new ArgumentNullException("filter"); UserRepository repository = new UserRepository(); return repository.Select(filter); }
/// <summary> /// /// </summary> /// <param name="user"></param> /// <returns></returns> /// <example> ///User user = UserComponent.Instance.GetByName(userName); ///user.InstitutionID = institutionID; ///user.FullName = fullName; ///user.RoleName = roleName; ///user.Telephone = telephone; ///user.Email = email; ///user.Comment = comment; ///user.IsApproved = isApproved; ///UserComponent.Instance.Save(user); /// </example> public User Save(User user) { if (user == null) throw new ArgumentNullException("user"); UserRepository repository = new UserRepository(); User original = repository.Select(user.UserName); if (original == null) throw new ApplicationException(String.Format("Uživatel '{0}' neexistuje.", user.UserName)); //original.RoleName = user.RoleName; original.Email = user.Email; original.Comment = user.Comment; original.FullName = user.FullName; original.Telephone = user.Telephone; original.InstitutionID = user.InstitutionID; original.LastUpdate = DateTime.Now; original.IsApproved = user.IsApproved; return repository.Update(user); }
public User GetByName(string userName) { UserRepository repository = new UserRepository(); return repository.Select(userName); }
public List<User> GetAll() { UserRepository repository = new UserRepository(); return repository.Select(); }