public async Task <NewsItem> CreateAsync(NewsItem entity, EmbeddedUser embeddedUser, string ip) { await _news.CreateAsync(entity); // Activity Log. await _activityLogService.CreateAsync(SystemKeyword.CreateNews, entity, embeddedUser, ip); return(entity); }
public async Task <EmailAccount> CreateAsync(EmailAccount entity, EmbeddedUser embeddedUser, string ip) { await _emailAccounts.CreateAsync(entity); if (entity.IsDefault) { _memoryCacheService.Remove(DefaultEmailAccount); } // Activity Log. await _activityLogService.CreateAsync(SystemKeyword.CreateEmailAccount, entity, embeddedUser, ip); return(entity); }
public async Task <Blob> CreateFolderAsync(Blob entity, EmbeddedUser embeddedUser, string ip) { await EnsureNotDuplicatedName(entity.Parent, entity.Name); var parentEntity = await GetByIdAsync(entity.Parent); if (parentEntity == null) { throw new BadRequestException(ApiStatusCode.Blob_InvalidParent, InvalidParentField); } var ancestors = new List <BlobAncestor>(parentEntity.Ancestors ?? new List <BlobAncestor>()); ancestors.Add(new BlobAncestor(parentEntity.Id, parentEntity.Name)); entity.Ancestors = ancestors; await _blobs.CreateAsync(entity); // Activity Log. await _activityLogService.CreateAsync(SystemKeyword.CreateBlob, entity, embeddedUser, ip); return(entity); }