public ActionResult Index()
        {
            var photo = new GalleryPhotoViewModel();

            photo.MapPhoto(PhotoRepository.GetLastUploadedPhoto());

            return(View(photo));
        }
        public ActionResult UploadPhoto(GalleryPhotoViewModel model, HttpPostedFileBase photo)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            _photoRepository.Add(model.MapPhoto(photo.FileName, UserRepository.GetUserId(User.Identity.Name)));

            photo.SaveAs(Path.Combine(Server.MapPath("~/Photos"), photo.FileName));
            return(RedirectToAction("Index"));
        }