Beispiel #1
0
        public async Task <IActionResult> ModifyPhoto(IndexViewData data)
        {
            if (!string.IsNullOrEmpty(data.PathToTheInputImage))
            {
                var customerData = await UserManager.GetUserAsync(User);

                var fileResponse = await FileManagerService.ModifyFile(new ModifyModel {
                    UserId            = customerData.Id,
                    OutputFileType    = data.SelectedResponseFileFormat,
                    SelectedOperation = data.SelectedFileOperation,
                    Intesivity        = data.Intensity,
                    UseFrame          = data.UseFrame
                });

                Logger.LogInformation($"Path to the result image, uploaded by the customer - {fileResponse.ResponseData.ToString()}");

                return(View("EditImage", new IndexViewData()
                {
                    PathToTheInputImage = "../" + data.PathToTheInputImage,
                    PathToTheResultImage = fileResponse.ResponseData.ToString()
                }));
            }
            else
            {
                ModelState.AddModelError("", "In order to edit photo, you should first provide it");

                return(View("EditImage", new IndexViewData()));
            }
        }