public int CreateOfficial(Official official) { string[] attributes = { "id:int", "identification:string", "name:string", "last_name:string", "email:string", "password:string", "rol:string", "status:bool" }; string pwd = official.GetAttribute("password")?.ToString(); official.SetPassword(MD5Hash.Hash.Content(pwd)); int id = CreateEntity(official, attributes); Close(); return(id); }
public bool UpdateOfficial(Official official) { List <string> attributes = new List <String> { "id:int", "identification:string", "name:string", "last_name:string", "email:string", "rol:string", "status:bool" }; string id = (official.GetAttribute("id").ToString()); string pwd = official.GetAttribute("password")?.ToString(); if (pwd != null) { attributes.Add("password:string"); official.SetPassword(MD5Hash.Hash.Content(pwd)); } bool isSuccessful = UpdateEntity(official, "id", id, attributes.ToArray()); Close(); return(isSuccessful); }