public ImageScraper( Func <int, Image> fetchImage, ImageRepo imageRepo) { _fetchImage = fetchImage; _imageRepo = imageRepo; }
public MergeController() { _webClient = new WebClient(); _imageRepo = new ImageRepo(); _dataDownloader = new DataDownloader(); _imageMerger = new ImageMerger(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = Convert.ToInt32(Request.QueryString["ID"]); List <Model.Image> productImage = ImageRepo.getImage(); var image = from j in productImage where j.ProductID == id select new { j.ImageName }; rptrProductImages.DataSource = image; rptrProductImages.DataBind(); List <Product> product = ProductRepo.getProduct(); var filter = from k in product where k.ProductID == id select new { k.ProductName, k.Price, k.Description }; rptrProducts.DataSource = filter; rptrProducts.DataBind(); } }
/// <summary> /// Adds images to given movie /// </summary> /// <param name="images">List of image upload results</param> /// <param name="movieId">Movie id</param> public async Task AddMovieImages(IEnumerable <UploadedImage> images, Guid movieId) { var imagesToAdd = images.Select(i => new Image { Url = i.Filepath }).ToList(); for (int i = 0; i < imagesToAdd.Count; ++i) { await ImageRepo.CreateAsync(imagesToAdd[i]); await ImageRepo.SaveChangesAsync(); } var movieImages = new List <MovieImage>(imagesToAdd.Count()); foreach (var img in imagesToAdd) { var type = images.FirstOrDefault(i => i.Filepath == img.Url)?.ImageType; var movieImage = new MovieImage { MovieId = movieId, ImageType = type, ImageId = img.Id }; movieImages.Add(movieImage); } MovieImageRepo.AddRange(movieImages); await MovieImageRepo.SaveChangesAsync(); }
/// <summary> /// Removes movie image entity and image entity /// and if there are no other image entities /// that points to the deleted image entity /// method returns underlying image url /// otherwise null is returned /// </summary> /// <param name="movieImageId">MovieImage entity id</param> /// <returns>Underlying image url or null</returns> public async Task <string> RemoveMovieImage(Guid movieImageId) { var movieImage = await MovieImageRepo .GetAll() .FirstOrDefaultAsync(mi => mi.Id == movieImageId); if (movieImage == null) { return(null); } var image = await ImageRepo .GetAll() .FirstOrDefaultAsync(i => i.Id == movieImage.ImageId); var otherImagesWithSameUrl = await ImageRepo .GetAll(i => i.Url == image.Url && i.Id != image.Id) .ToListAsync(); MovieImageRepo.Delete(movieImage); await MovieImageRepo.SaveChangesAsync(); ImageRepo.Delete(image); await ImageRepo.SaveChangesAsync(); return(otherImagesWithSameUrl.Count > 0 ? null : image.Url); }
public ImagesController(ImageRepo repo) { _repo = repo; if (Environment.GetCommandLineArgs().Length > 1) { _mode = Environment.GetCommandLineArgs()[1] == "nb" ? ServerMode.NonBlocking : ServerMode.Blocking; System.Console.WriteLine(Environment.GetCommandLineArgs()[1]); } else { _mode = ServerMode.Blocking; } }
/// <summary> /// Adds images to given movie /// </summary> /// <param name="images">List of image paths</param> /// <param name="movieId">Movie id</param> public async Task AddMovieImages(IEnumerable <string> images, Guid movieId) { var imagesToAdd = images.Select(i => new Image { Url = i }); ImageRepo.AddRange(imagesToAdd); await ImageRepo.SaveChangesAsync(); var movieImages = imagesToAdd.Select(i => new MovieImage { ImageId = i.Id, MovieId = movieId, ImageType = MovieImageType.Image }); MovieImageRepo.AddRange(movieImages); await MovieImageRepo.SaveChangesAsync(); }
/// <summary> /// Adds image to given movie /// </summary> /// <param name="url">Image location</param> /// <param name="movieId">Movie id</param> /// <param name="type">Image type</param> public async Task AddMovieImage(string url, Guid movieId, MovieImageTypeEnum type) { var image = new Image { Url = url }; await ImageRepo.CreateAsync(image); await ImageRepo.SaveChangesAsync(); var movieImage = new MovieImage { ImageId = image.Id, MovieId = movieId, ImageType = MovieImageType.ToStr(type) }; await MovieImageRepo.CreateAsync(movieImage); await MovieImageRepo.SaveChangesAsync(); }
private void showProduct(int id) { List <Model.Promotion> promo = PromotionRepo.getPromo(); List <Product> prod = new List <Product>(); List <Model.Image> img = new List <Model.Image>(); if (id == 0) { prod = ProductRepo.getProduct(); img = ImageRepo.getImage(); var list = from p in prod join i in img on p.ProductID equals i.ProductID join z in promo on p.ProductID equals z.ProductID where p != null select new { p.ProductID, p.ProductName, p.Price, i.ImageName, z.Discount, newPrice = p.Price - ((p.Price * z.Discount) / 100) }; repeaterPromotion.DataSource = list; repeaterPromotion.DataBind(); } else { prod = ProductRepo.getProductById(id); img = ImageRepo.getImage(); var list = from p in prod join i in img on p.ProductID equals i.ProductID join z in promo on p.ProductID equals z.ProductID where p != null select new { p.ProductID, p.ProductName, p.Price, i.ImageName, z.Discount, newPrice = p.Price - ((p.Price * z.Discount) / 100) }; repeaterPromotion.DataSource = list; repeaterPromotion.DataBind(); } }
private void showProduct(int id) { prod = ProductRepo.getProduct(); img = ImageRepo.getImage(); var list = from p in prod join i in img on p.ProductID equals i.ProductID where p != null && p.VendorFlag == id select new { p.ProductID, p.ProductName, p.Price, i.ImageName }; repeaterEditItem.DataSource = list; repeaterEditItem.DataBind(); }
protected void BtnDB_Click(object sender, EventArgs e) { List <Model.Image> productImage = ImageRepo.getImage(); List <Product> product = ProductRepo.getProduct(); var filter = from i in product join j in productImage on i.ProductID equals j.ProductID where i.ProductCategoryID == 2 && i.SubCategoryID == 8 group j by j.ProductID into ij select new { ij.FirstOrDefault().Product.ProductName, ij.FirstOrDefault().Product.Price, ij.FirstOrDefault().ImageName }; rptrProducts.DataSource = filter; rptrProducts.DataBind(); }
private void showProductWithSubCategory(int id, int Subcat) { List <Product> prod = ProductRepo.getProductById(id); List <Model.Image> img = ImageRepo.getImage(); var list = from p in prod join i in img on p.ProductID equals i.ProductID where p != null && p.SubCategoryID == Subcat select new { p.ProductName, p.Price, i.ImageName }; repeaterProdSeeMore.DataSource = list; repeaterProdSeeMore.DataBind(); }
private void showProduct(int id) { List <Product> prod = new List <Product>(); List <Model.Image> img = new List <Model.Image>(); if (id == 7) { LblClick.Visible = true; LblClick.Text = "All Category"; prod = ProductRepo.getProduct(); img = ImageRepo.getImage(); var list = from p in prod join i in img on p.ProductID equals i.ProductID where p != null select new { p.ProductID, p.ProductName, p.Price, i.ImageName }; repeaterClick.DataSource = list; repeaterClick.DataBind(); } else { prod = ProductRepo.getProductById(id); img = ImageRepo.getImage(); var list = from p in prod join i in img on p.ProductID equals i.ProductID where p != null select new { p.ProductID, p.ProductName, p.Price, i.ImageName }; repeaterClick.DataSource = list; repeaterClick.DataBind(); } buttonControl(); }
private void showProduct(int id) { List <Product> prod = new List <Product>(); List <Model.Image> img = new List <Model.Image>(); if (id == 0) { prod = ProductRepo.getProduct(); img = ImageRepo.getImage(); var list = from p in prod join i in img on p.ProductID equals i.ProductID where p != null select new { p.ProductID, p.ProductName, p.Price, i.ImageName }; repeaterProdSeeMore.DataSource = list; repeaterProdSeeMore.DataBind(); } else { prod = ProductRepo.getProductById(id); img = ImageRepo.getImage(); var list = from p in prod join i in img on p.ProductID equals i.ProductID where p != null select new { p.ProductID, p.ProductName, p.Price, i.ImageName }; repeaterProdSeeMore.DataSource = list; repeaterProdSeeMore.DataBind(); } }
public void BeforeEachTest() { _imageRepo = new ImageRepo(); _imageData = "[{\"albumId\": 1,\"id\": 1, \"title\":\"T\",\"url\":\"LOL\",\"thumbnailUrl\":\"LOL\"}]"; _albumData = "[{\"id\": 1,\"title\": \"TEST\", \"userId\":1}]"; _resultImage = new ImageJson { albumId = 1, id = 1, thumbnailUrl = "LOL", title = "T", url = "LOL" }; _resultAlbum = new AlbumJson { id = 1, title = "TEST", userId = 1 }; }
public IReadOnlyList <ImageModel> GetImagesArt(Card card) => ImageRepo.GetArts(card, CardRepo.GetReleaseDateSimilarity);
public IReadOnlyList <ImageModel> GetZoomImages(Card card) => ImageRepo.GetZooms(card, CardRepo.GetReleaseDateSimilarity);
public ImageModel GetSmallImage(Card card) => ImageRepo.GetSmallImage(card, CardRepo.GetReleaseDateSimilarity);
public ImageController() { _imageRepo = new ImageRepo(); }