private async Task <SharedFolderModelBussines <int> > CreateSharing(SharedFolderModelApi <int> sharingModel, AccountModelBussines <int> acc) { var mappedSharedFolder = AutoMapperConfig.Mapper.Map <SharedFolderModelBussines <int> >(sharingModel); mappedSharedFolder.AccountId = acc.Id; var res = await this._sharedFolderRepository.CreateAsync(mappedSharedFolder); return(res); }
public async Task <ResponseModel <SharedFolderModelApi <int> > > ShareFolder(SharedFolderModelApi <int> sharingModel) { var acc = await this._accountRepository.GetByEmailAsync(sharingModel.AccountEmail); var resp = new ResponseModel <SharedFolderModelApi <int> >(); if (acc == null) { resp.AddError(new Error($"This user not exists")); return(resp); } await this._redisCachingService.RemoveItemAsync(RedisCachingKeysUtil.GET_SHARED_FOLDERS_BY_USER_ID + acc.Id); var folder = await this._storedFolderRepository.GetByIdAsync(sharingModel.StoredFolderId); await NotifyAboutSharing(folder.Title, acc.Id); resp.Item = AutoMapperConfig.Mapper.Map <SharedFolderModelApi <int> >(await CreateSharing(sharingModel, acc)); return(resp); }
public async Task <IActionResult> StoredFile(SharedFolderModelApi <int> model) { var res = await this._sharedFolderService.ShareFolder(model); return(Ok(res)); }