public ActionResult Upload(HttpPostedFileBase upload)
        {
            if (ModelState.IsValid)
            {
                if (upload != null && upload.ContentLength > 0)
                {
                    EducateMeEntities entities = new EducateMeEntities();
                    Background background = entities.Backgrounds.Create<Background>();
                    background.name = "mapppp";
                    using (var reader = new BinaryReader(upload.InputStream))
                    {
                        background.image = reader.ReadBytes(upload.ContentLength);
                    }
                    background.imageType = upload.FileName.Substring(upload.FileName.Length-4);
                    //background.ID = 5;

                    entities.Backgrounds.Add(background);
                    entities.SaveChanges();

                    return View("Administration", background);
                }
            }

            return View("Administration");
        }
 public ActionResult ShowImage(int id)
 {
     EducateMeEntities Entities = new EducateMeEntities();
     byte[] imageData = Entities.Backgrounds.First().image;
     //if (imageData != null && imageData.Length > 0)
     //{
         return new FileStreamResult(new System.IO.MemoryStream(imageData), "image/jpeg");
     //}
 }
        public ActionResult Index()
        {
            EducateMeEntities Entities = new EducateMeEntities();
            BackgroundViewModel model = new BackgroundViewModel();

            model.Questionnaire = Entities.Questionnaires.First();

            return View(model);
        }