private async Task ExecuteConsoleCommandGetUserInfo(Options options) { var getUserQuery = new GetUserInfoQuery(options); var userInfoResponceModel = await _mediator.Send(getUserQuery); var userInfoViewModel = new UserInfoViewModel { CreationDate = ConvertingHelper.GetDateString(userInfoResponceModel.CreationDate), Login = userInfoResponceModel.Login, UsedStorage = ConvertingHelper.GetSizeString(userInfoResponceModel.UsedStorage) }; _consolePrinter.PrintUserInformation(userInfoViewModel); }
private async Task ExecuteConsoleCommandFileUpload(Options options) { var fileUploadCommand = new FileUploadCommand(options); var storageFile = await _mediator.Send(fileUploadCommand); FileUploadViewModel uploadViewModel = new FileUploadViewModel { FilePath = fileUploadCommand.FilePath, FileName = Path.GetFileName(fileUploadCommand.FilePath), FileSize = ConvertingHelper.GetSizeString(storageFile.Size), Extension = storageFile.Extension }; LogInformationMessage($"File \"{fileUploadCommand.FilePath}\" has been uploaded"); _consolePrinter.PrintFileUploadedSuccessful(uploadViewModel); }
private async Task ExecuteConsoleCommandDirectoryInfo(Options options) { var getDirectoryInfoQuery = new GetDirectoryInfoQuery(options); var directoryInfo = await _mediator.Send(getDirectoryInfoQuery); var directoryInfoViewModel = new DirectoryInfoViewModel() { CreationDate = ConvertingHelper.GetDateString(directoryInfo.CreationDate), ModificationDate = ConvertingHelper.GetDateString(directoryInfo.ModificationDate), Login = directoryInfo.Login, Name = directoryInfo.Name, Path = directoryInfo.Path, Size = ConvertingHelper.GetSizeString(directoryInfo.Size) }; _consolePrinter.PrintDirectoryInfo(directoryInfoViewModel); }
private async Task ExecuteConsoleCommandFileInfo(Options options) { var fileInfoQuery = new GetFileInfoQuery(options); var fileInfoResponseModel = await _mediator.Send(fileInfoQuery); FileInfoViewModel fileInfoViewModel = new FileInfoViewModel { FileName = fileInfoResponseModel.FileName, Extension = fileInfoResponseModel.Extension, CreationDate = ConvertingHelper.GetDateString(fileInfoResponseModel.CreationDate), FileSize = ConvertingHelper.GetSizeString(fileInfoResponseModel.FileSize), DownloadsNumber = fileInfoResponseModel.DownloadsNumber, Login = fileInfoResponseModel.Login }; _consolePrinter.PrintFileInfo(fileInfoViewModel); }