public static Cart ExtractCartFromCookie(HttpCookie cookie) { if (cookie == null) throw new ArgumentNullException("cookie"); Cart cart = JsonConvert.DeserializeObject<Cart>(cookie.Value); if (cart == null) cart = new Cart(); return cart; }
public void CreateOrder(Cart cart, string userId) { var videos = db.Videos.Where(v => cart.Videos.Contains(v.VideoID)); var value = videos.Sum(v => v.Price); Order order = new Order { UserID = userId, Videos = videos.ToList(), OrderValue = value, }; Add(order); if (userId != Consts.anonymousUserID) AddOrderInfoToUser(order); }
public void CreateOrder(Cart cart, string userId) { }