Beispiel #1
0
 public List<ShoopingCartView> GetAllCarts()
 {
     using (var repo = new ShoppingCartRepository())
     {
         return repo.GetAll().Select(p => new ShoopingCartView
         {
             Id = p.Id,
             isBought = p.isBought,
             Username = p.Username,
             Price = p.Price,
             SubCost = p.SubCost,
             ProductID = p.ProductID,
             ProuductName = p.ProuductName,
             Qty = p.Qty
         }).ToList();
     }
 }
Beispiel #2
0
        public void UpdateCheck(string username)
        {
            using (var rep = new ShoppingCartRepository())
               {
               List<ShoppingCart> shop = rep.GetAll().Where(x => x.Username.Equals(username)).ToList();

               foreach (ShoppingCart a in shop)
               {
                   a.isBought = true;

                   rep.Update(a);
               }
               }
        }