Esempio n. 1
0
        public IActionResult Images()
        {
            ImagedbManager      mgr    = new ImagedbManager(_connectionstring);
            IEnumerable <Image> images = mgr.GetImages();

            return(View(images));
        }
Esempio n. 2
0
        public IActionResult Image(int imageid)
        {
            ImagedbManager mgr   = new ImagedbManager(_connectionstring);
            ImageViewMdl   Model = new ImageViewMdl();

            Model.image      = mgr.GetImageById(imageid);
            Model.LikedImage = true;
            return(View(Model));
        }
Esempio n. 3
0
        public IActionResult UploadImage(IFormFile myFile, Image I)
        {
            string fileName = $"{Guid.NewGuid()}{Path.GetExtension(myFile.FileName)}";
            string fullPath = Path.Combine(_environment.WebRootPath, "uploads", fileName);

            using (FileStream stream = new FileStream(fullPath, FileMode.CreateNew))
            {
                myFile.CopyTo(stream);
            }

            ImagedbManager mgr = new ImagedbManager(_connectionstring);

            I.FileName = fileName;
            mgr.AddImage(I);

            return(Redirect("/"));
        }
Esempio n. 4
0
        public int GetImageLikeCount(int id)
        {
            ImagedbManager mgr = new ImagedbManager(_connectionstring);

            return(mgr.GetNumberOfLikesForImage(id));
        }
Esempio n. 5
0
        public void AddLikeToImage(int iid)
        {
            ImagedbManager mgr = new ImagedbManager(_connectionstring);

            mgr.AddLikeToImage(iid);
        }