public ActionResult DeleteQuestion(int id)
        {
            var exId   = _examinationRepository.GetExamQuestion(id);
            int examId = exId.Examination.Id;

            _examinationRepository.DeleteQuestion(id);
            return(RedirectToAction("Qustion", new { examId }));
        }
Esempio n. 2
0
        public FileContentResult GetQuestionImage(int id)
        {
            var v = _examinationRepository.GetExamQuestion(id);

            if (v != null)
            {
                byte[] byteArray = v.ImageData;
                using (var outStream = new MemoryStream())
                {
                    using (var inStream = new MemoryStream(byteArray))
                    {
                        //
                        var settings = new ResizeSettings("maxwidth=400&maxheight=100");
                        ImageBuilder.Current.Build(inStream, outStream, settings);
                        var outBytes = outStream.ToArray();
                        return(new FileContentResult(outBytes, "image/jpeg"));
                    }
                }
            }

            return(null);
        }