public CartCL viewCart(CartCL cartCL) { Cart query = (from type in dbcontext.Carts where type.MemberId == cartCL.memberId select type).FirstOrDefault(); CartCL view = new CartCL() { id = query.Id, dateAdded = query.DateAdded, memberId = query.MemberId, shippingCost = query.ShippingCost }; return(view); }
//Instantiates the DataBase model from edmx file in this Solution. public void addtoCart(CartCL cartCL) { dbcontext.Carts.Add(new Cart { DateAdded = cartCL.dateAdded, ShippingCost = cartCL.shippingCost, Id = cartCL.id, MemberId = cartCL.memberId, DateModified = cartCL.dateModified, IsDeleted = cartCL.isDeleted, }); dbcontext.SaveChanges(); }
public CartCL getCartbyId(int cartId) { Cart cartQuery = (from y in dbcontext.Carts where y.Id == cartId select y).FirstOrDefault(); CartCL cartCL = new CartCL() { dateAdded = cartQuery.DateAdded, dateModified = cartQuery.DateModified, id = cartQuery.Id, isDeleted = cartQuery.IsDeleted, memberId = cartQuery.MemberId, shippingCost = cartQuery.ShippingCost }; return(cartCL); }