async Task CheckName(ActionExecutingContext context)
        {
            var boundary = HeaderUtilities.RemoveQuotes(MediaTypeHeaderValue.Parse(context.HttpContext.Request.ContentType).Boundary).Value;

            try
            {
                _reader = new MultipartReader(boundary, context.HttpContext.Request.Body);

                _section = await _reader.ReadNextSectionAsync();

                _printerName = await _section.ReadAsStringAsync();
            }
            catch (Exception e)
            {
                context.ActionArguments["requestResult"] = true;
            }

            Use_Install_Printers_Api api = new Use_Install_Printers_Api();

            var tempCol = await api.GetPrinters();

            var tempPrinterName = tempCol.Select(x => x.PrinterName == _printerName).ToList();

            if (tempPrinterName.Contains(true))
            {
                _reader = null;

                _section = null;

                context.ActionArguments["requestResult"] = true;
            }
        }
Beispiel #2
0
        public async Task <IActionResult> UploadPrinterDriver()
        {
            ViewBag.message = "Ожидание загрузки файла";

            return(View(await api.GetPrinters()));
        }