public int AdminNewRecord(string userName) { using (RepositoryAdmin repositoryAdmin = new RepositoryAdmin()) { repositoryAdmin.CUDOperation(new Admin() { Id = Guid.NewGuid(), UserName = userName, Password = PasswordCrypto.EncryptToSha512("demo") }, EntityState.Added); return(repositoryAdmin.SaveChanges()); } }
public int ResetAdminPassword(Admin admin, string password) { if (admin != null && !string.IsNullOrEmpty(password) && !string.IsNullOrWhiteSpace(password)) { using (RepositoryAdmin repositoryAdmin = new RepositoryAdmin()) { admin.Password = PasswordCrypto.EncryptToSha512(password); repositoryAdmin.CUDOperation(admin, EntityState.Modified); return(repositoryAdmin.SaveChanges()); } } else { return(-1); } }