Exemplo n.º 1
0
        //clicks
        public void SaveClick(long id)
        {
            ApplicationDbContext context = new ApplicationDbContext();
            var          todaysClicks    = context.Clicks.Where(c => c.DateClicked > DateTime.Today && c.DateClicked <= DateTime.Now);
            ProductClick productClick    = todaysClicks.Where(p => p.ProductId == id).FirstOrDefault();
            ProductClick click           = new ProductClick();

            if (productClick == null)
            {
                click.ClickCount = 1;
                click.ProductId  = id;
                context.Clicks.Add(click);
            }
            else
            {
                productClick.ClickCount++;
            }
            context.SaveChanges();
        }
Exemplo n.º 2
0
 private void lblNombre_Click(object sender, EventArgs e)
 {
     ProductClick?.Invoke(this, e);
 }
Exemplo n.º 3
0
        public Product ToProduct(ProductClick click)
        {
            Product product = repository.Products.Where(p => p.ProductId == click.ProductId).FirstOrDefault();

            return(product);
        }