public void Update(Administrator administrator) { using (ConfigDatabase db = this.Store.CreateContext()) { Update(db, administrator); db.SubmitChanges(); } }
/// <summary> /// Add an administrator to the database using the given database context /// The administrator will be added within the context's currently active transaction /// </summary> /// <param name="administrator">administrator object</param> public Administrator Add(Administrator administrator) { using (ConfigDatabase db = this.Store.CreateContext()) { Add(db, administrator); db.SubmitChanges(); return administrator; } }
public Administrator(Administrator that) { this.CreateDate = that.CreateDate; this.ID = that.ID; this.PasswordHash = that.PasswordHash; this.Status = that.Status; this.UpdateDate = that.UpdateDate; this.Username = that.Username; }
private static void Print(Administrator administrator) { CommandUI.Print("Username", administrator.Username); CommandUI.Print("ID", administrator.ID); CommandUI.Print("Status", administrator.Status); CommandUI.Print("CreateDate", administrator.CreateDate); CommandUI.Print("UpdateDate", administrator.UpdateDate); }
private static void Update(ConfigDatabase db, Administrator administrator) { if (db == null) { throw new ArgumentNullException("db"); } if (administrator == null) { throw new ConfigStoreException(ConfigStoreError.InvalidAdministrator); } Administrator update = new Administrator(administrator); db.Administrators.Attach(update); update.UpdateFrom(administrator); }
//public bool CheckPasswordHash(string username, string passwordHash) //{ // using (ConfigDatabase db = this.Store.CreateContext()) // { // return CheckPasswordHash(db, username, passwordHash); // } //} private static void Add(ConfigDatabase db, Administrator administrator) { if (db == null) { throw new ArgumentNullException("db"); } if (administrator == null) { throw new ConfigStoreException(ConfigStoreError.InvalidAdministrator); } db.Administrators.InsertOnSubmit(administrator); }
public void UpdateFrom(Administrator that) { this.PasswordHash = that.PasswordHash; this.Status = that.Status; this.UpdateDate = DateTimeHelper.Now; }