public ActionResult Create()
 {
     var model = new SampleViewModel();
     model.Image.Width = 100;
     model.Image.Height = 100;
     return View(model);
 }
        public ActionResult Edit(int id, SampleViewModel model)
        {
            var context = new MainContext();
            var sample = context.Samples.FirstOrDefault(s => s.Id == id);
            sample = Mapper.Map(model, sample);
            context.SaveChanges();

            return RedirectToAction("Index");
        }
        public ActionResult Create(SampleViewModel model)
        {
            var entity = Mapper.Map<Sample>(model);
            var context = new MainContext();
            context.Samples.Add(entity);
            context.SaveChanges();

            return RedirectToAction("Index");
        }