public Cookie(string email) { using (ShopEntityDb db = new ShopEntityDb()) { this.Email = email; Account account = db.Accounts.FirstOrDefault(n => n.Email == email); this.id = account.AccountID; this.name = account.Name; this.Password = account.Password; this.PhotoPath = account.PhotoPath; } }
public Cart(int Ids) { using (ShopEntityDb db = new ShopEntityDb()) { this.Id = Ids; Product sp = db.Products.Single(n => n.ProductID == Ids); this.name = sp.ProductName; this.cost = sp.Price.Value; this.photo = sp.PhotoPath; this.count = 1; this.intoMoney = cost * count; } }