diff --git a/Yavsc/ApiControllers/PdfEstimateController.cs b/Yavsc/ApiControllers/PdfEstimateController.cs index 91965303..9fb1dd11 100644 --- a/Yavsc/ApiControllers/PdfEstimateController.cs +++ b/Yavsc/ApiControllers/PdfEstimateController.cs @@ -8,6 +8,7 @@ using Microsoft.AspNet.Razor; namespace Yavsc.ApiControllers { using Models; + using Helpers; [Route("api/pdfestimate"), Authorize] public class PdfEstimateController : Controller @@ -87,5 +88,13 @@ namespace Yavsc.ApiControllers { return ViewComponent("Estimate",new object[] { id, "Pdf" } ); } + + [HttpPost("prosign/{id}")] + public IActionResult ProSign(long id) + { + if (Request.Form.Files.Count!=1) + return new BadRequestResult(); + return Ok (User.ReceiveProSignature(id,Request.Form.Files[0])); + } } } \ No newline at end of file diff --git a/Yavsc/Avatars/Paul.png b/Yavsc/Avatars/Paul.png deleted file mode 100644 index cff89237..00000000 Binary files a/Yavsc/Avatars/Paul.png and /dev/null differ diff --git a/Yavsc/Avatars/Paul.s.png b/Yavsc/Avatars/Paul.s.png deleted file mode 100644 index 89b956bf..00000000 Binary files a/Yavsc/Avatars/Paul.s.png and /dev/null differ diff --git a/Yavsc/Avatars/Paul.xs.png b/Yavsc/Avatars/Paul.xs.png deleted file mode 100644 index 34b28314..00000000 Binary files a/Yavsc/Avatars/Paul.xs.png and /dev/null differ diff --git a/Yavsc/Helpers/FileSystemHelpers.cs b/Yavsc/Helpers/FileSystemHelpers.cs index cc294e89..27ebac41 100644 --- a/Yavsc/Helpers/FileSystemHelpers.cs +++ b/Yavsc/Helpers/FileSystemHelpers.cs @@ -1,5 +1,6 @@ +using System; using System.Drawing; using System.Drawing.Imaging; using System.IO; @@ -101,10 +102,6 @@ namespace Yavsc.Helpers item.FileName = user.UserName + ".png"; var destFileName = Path.Combine(Startup.SiteSetup.UserFiles.Avatars, item.FileName); - ImageProcessor.ImageFactory f = new ImageProcessor.ImageFactory(); - - ImageProcessor.Web.Processors.Resize r = new ImageProcessor.Web.Processors.Resize(); - var fi = new FileInfo(destFileName); if (fi.Exists) item.Overriden = true; Rectangle cropRect = new Rectangle(); @@ -166,5 +163,25 @@ namespace Yavsc.Helpers dir, xsmallname), ImageFormat.Png); } } + + public static FileRecievedInfo ReceiveProSignature(this ClaimsPrincipal user, long estimateId, IFormFile formFile) + { + var item = new FileRecievedInfo(); + item.FileName = $"estimate-prosign-{estimateId}.png"; + var destFileName = Path.Combine(Startup.SiteSetup.UserFiles.Blog, item.FileName); + + var fi = new FileInfo(destFileName); + if (fi.Exists) item.Overriden = true; + + using (var org = formFile.OpenReadStream()) + { + Image i = Image.FromStream(org); + using (Bitmap source = new Bitmap(i)) + { + source.Save(destFileName, ImageFormat.Png); + } + } + throw new NotImplementedException(); + } } } diff --git a/Yavsc/Views/Manage/SetActivity.cshtml b/Yavsc/Views/Manage/SetActivity.cshtml index 0dd745c0..ba11b351 100644 --- a/Yavsc/Views/Manage/SetActivity.cshtml +++ b/Yavsc/Views/Manage/SetActivity.cshtml @@ -101,7 +101,7 @@ } }); }); - @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } } +