public ActionResult MyAccount()
        {
            var Db   = new ImageUploadDB(Properties.Settings.Default.ConStr);
            var user = Db.GetByEmail(User.Identity.Name);

            return(View(Db.GetImagesByUserId(user.Id)));
        }
        public ActionResult Index()
        {
            var Db  = new ImageUploadDB(Properties.Settings.Default.ConStr);
            var IVM = new IndexViewModel
            {
                IsAuthenticated = User.Identity.IsAuthenticated,
                User            = Db.GetByEmail(User.Identity.Name)
            };

            return(View(IVM));
        }
        public ActionResult Upload(Image image, HttpPostedFileBase imageFile)
        {
            string fileName = Guid.NewGuid().ToString() + Path.GetExtension(imageFile.FileName);

            imageFile.SaveAs(Server.MapPath("~/UploadedImages/") + fileName);
            image.FileName = fileName;
            var    Db    = new ImageUploadDB(Properties.Settings.Default.ConStr);
            string email = User.Identity.Name;
            User   user  = Db.GetByEmail(email);

            image.UserId = user.Id;
            Db.Add(image);
            return(View(image));
        }