public ActionResult Index(ImageModel imageModel, HttpPostedFileBase postedFile)
        {
            var relativePath = WebConfigurationManager.AppSettings["ImageCarouselRoute"];

            if (imageModel != null && ModelState.IsValid)
            {
                if (postedFile != null && postedFile.ContentLength > 0)
                {
                    Guid uniqueId = Guid.NewGuid();
                    var fileName = Path.GetFileName(postedFile.FileName);
                    var extension = Path.GetExtension(postedFile.FileName);
                    var contentType = postedFile.ContentType;

                    var internalName = uniqueId.ToString() + extension;
                    imageModel.Extension = extension;
                    imageModel.FileName = internalName;
                    imageModel.ContentType = contentType;

                    var physicalPath = Path.Combine(Server.MapPath("/"), relativePath, internalName);
                    postedFile.SaveAs(physicalPath);

                    var imageEntity = imageModel.ToEntity();
                    _service.Create(imageEntity);

                    return RedirectToAction("Index","Home");
                }
            }
            return View(imageModel);
        }
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public ActionResult Index()
 {
     var imageModel = new ImageModel();
     imageModel.FileNames = _service.GetAll()
                                    .Select(p => p.FileName)
                                    .ToList();
     return View(imageModel);
 }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            int maxSlideTo = 4;
            int cont = 0;
            var fileNames = _service.GetAll()
                                    .OrderByDescending(p => p.ImageId)
                                    .Select(p => p.FileName);
            List<string> auxFileNames = new List<string>();
            foreach (var fileName in fileNames)
            {
                if (cont == maxSlideTo)
                {
                    break;
                }
                auxFileNames.Add(fileName);
                cont++;
            }
            var imageModel = new ImageModel(){ FileNames = auxFileNames };

            return View(imageModel);
        }