Пример #1
0
        public async Task <ActionResult <string> > UploadMessageImage(IFormFile file)
        {
            try
            {
                var info = await fsImageManager.SaveMessageImage(file);

                await imageManager.Add(info);

                return(Ok(info.Id));
            }
            catch
            {
                return(UnprocessableEntity());
            }
        }
Пример #2
0
        public ActionResult AdsAdditional(Phone phone, HttpPostedFileBase image = null)
        {
            if (ModelState.IsValid)
            {
                User user = userManager.GetUserByCookies(HttpContext.Request.Cookies[Constants.NameCookie].Value);
                phone.UserId = user.UserId;

                phoneManager.Add(phone);

                if (image != null)
                {
                    string fileName = Path.GetFileName(image.FileName);
                    var    path     = Path.Combine(Server.MapPath("~/Images/"), fileName);
                    image.SaveAs(path);

                    ApplicationImage appImage = new ApplicationImage()
                    {
                        Image   = Url.Content("~/Images/" + fileName),
                        PhoneId = phoneManager.GetPhoneId(phone)
                    };

                    imageManager.Add(appImage);
                }

                return(RedirectToAction("AdResult", phone));
            }
            return(View(phone));
        }
Пример #3
0
        public Workspace(InputPanel ip, KeyPanel kp, ITemplateForm currentTemplate) : this()
        {
            for (int i = 0; i < ip.SelectedInputs.Count; i++)
            {
                string guid = Guid.NewGuid().ToString();

                imageManager.Add(guid, ip.SelectedInputs[i]);

                myImages.Add(guid, ip.SelectedInputs[i]);
            }

            if (kp.AnswerImage != null)
            {
                imageManager.Add(Workspace.IMGMGR_ANSWERS, kp.AnswerImagePath);

                myAnswerkeyPath = kp.AnswerImagePath;
            }

            omrProcessor = new ProcessOmrDocumentsOperation(kp.AnswerImage, currentTemplate, imageManager, myImages);

            this.PassingGrade           = kp.PassingGrade;
            this.verificationParameters = VerificationParameters.GetTemplate(VerificationParameters.FilterTemplate.CommonIssues);
        }
        public async Task <IActionResult> Add()
        {
            var files = Request.Form.Files;

            foreach (var file in files)
            {
                using (var memoryStream = new MemoryStream())
                {
                    // Copy to memory first
                    await file.CopyToAsync(memoryStream);

                    memoryStream.Position = 0;

                    await _manager.Add(memoryStream);
                }
            }

            return(Ok());
        }