Ejemplo n.º 1
0
 public ProductsController(Models.Znachor ctx)
 {
     GetUserId = () => User.Identity.GetUserId();
     if (ctx != null)
     {
         _ctx = ctx;
     }
     else
     {
         _ctx = new Models.Znachor();
     }
 }
Ejemplo n.º 2
0
        public static string GetCartValue(string id)
        {
            var     ctx    = new Models.Znachor();
            decimal sum    = 0;
            var     values = ctx.Koszyks.Where(x => x.AspNetUsersid == id);

            if (values.Any())
            {
                foreach (var v in values)
                {
                    var towar = ctx.Towars.First(x => x.id_towaru == v.Towarid_towaru);
                    sum += v.ilosc_sztuk * towar.cena_netto;
                }
            }
            return(sum.ToString());
        }