public string InitializeCart() { // TODO // check session expiration // currently this just returns true // needs time check in session utility if (_session.IsValid()) { if (!_cart.NeedACart()) // kind of a double negative but checks session for cart-id { return(_session.GetSession("cart")); } if (_cart.MakeNewCart().Result == true) // hit when starting new session { IPAddress ip = Request.HttpContext.Connection.LocalIpAddress; var details = new SessionLog() // log the session information { cart_id = _session.GetSession("cart"), session_id = _session.CurrentSession(), client_ip = ip.ToString() }; _log.Session(details); return(details.cart_id); // return with the cart id } // TODO error creating the new cart } var error = "you messed up"; // error in session. figure out how to reset return(error); }