예제 #1
0
    protected async void ButtonDownloadPage_Click(object sender, EventArgs e)
    {
        IMineProduct mp            = new MineWallMart(); //some infrastucture for dependency injection in the future to support other suppliers
        string       productNumber = await mp.MineProduct(TextBoxProductUrl.Text);

        Product           product = null;
        List <ReviewShow> myReviews;

        using (DatabaseRpoundForestEntities db = new DatabaseRpoundForestEntities())
        {
            product   = db.Products.Where((x) => x.SellerInternalId == productNumber).FirstOrDefault();
            myReviews = db.Reviews
                        .Where((x) => x.ProductId == product.Id)
                        .Select((x) => new ReviewShow {
                reviewTitle = x.ReviewTitle, reviewText = x.ReviewText, rating = x.Stars.ToString()
            })
                        .ToList <ReviewShow>();
        }
        Session["productid"]  = product.Id;
        LabelProductInfo.Text = String.Format("Product Seller Number: {0} Product name: {1}", product.SellerInternalId, product.ProductName);
        GridView1.DataSource  = myReviews;
        GridView1.DataBind();
    }
 public async void Post([FromBody] UrlToGet url)
 {
     IMineProduct mwm           = new MineWallMart();
     string       productNumber = await mwm.MineProduct(url.Url);
 }