public void ChangePassword(int userID, string newPassword) { DomainUser domainUser = GetDomainUserByID(userID); if (domainUser != null && !string.IsNullOrEmpty(newPassword)) { byte[] salt, hashedPassword; PasswordEncoder.EncryptPassword(newPassword, out salt, out hashedPassword); domainUser.Password = hashedPassword; domainUser.Salt = salt; _context.Entry(domainUser).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); CacheController.ResetCacheItem(CacheController.CacheItemKey.UserByID); CacheController.ResetCacheItem(CacheController.CacheItemKey.UserByEmail); } }
public void UpdateFolder(Folder folder) { if (folder != null) { DomainFolder domainFolder = GetDomainFolderByID(folder.ID); if (domainFolder != null) { domainFolder.DataItem.Title = folder.Title; domainFolder.DataItem.ParentFolderID = folder.ParentFolderID; _context.Entry(domainFolder).State = System.Data.Entity.EntityState.Modified; _context.Entry(domainFolder.DataItem).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); CacheController.ResetDataCacheItems(); } } }
public void Save(Document document) { if (document != null) { DomainDocument domainDocument = GetDomainDocumentByID(document.ID); if (domainDocument != null) { domainDocument.DataItem.Title = document.Title; domainDocument.DataItem.ParentFolderID = document.ParentFolderID; domainDocument.FileID = document.FileID; domainDocument.FileExtension = document.FileExtension; _context.Entry(domainDocument).State = System.Data.Entity.EntityState.Modified; _context.Entry(domainDocument.DataItem).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); CacheController.ResetDataCacheItems(); } } }