public IActionResult Images() { ImagedbManager mgr = new ImagedbManager(_connectionstring); IEnumerable <Image> images = mgr.GetImages(); return(View(images)); }
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)); }
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("/")); }
public int GetImageLikeCount(int id) { ImagedbManager mgr = new ImagedbManager(_connectionstring); return(mgr.GetNumberOfLikesForImage(id)); }
public void AddLikeToImage(int iid) { ImagedbManager mgr = new ImagedbManager(_connectionstring); mgr.AddLikeToImage(iid); }