public ActionResult AddToCart(string id)
        {
            DAL.RestaurantMenu    restaurantMenu = menuModel.find(int.Parse(DataSecurityTripleDES.GetPlainText(id)));
            RestaurantMenuCartDTO thisMenuDTO    = EntityDTOHelper.GetEntityDTO <RestaurantMenu, RestaurantMenuCartDTO>(restaurantMenu);

            DAL.Restaurant restaurant = db.Restaurant.Find(restaurantMenu.OwnerId);

            thisMenuDTO.ServiceOwnerName = restaurant.Name;
            thisMenuDTO.ServiceOwnerId   = DataSecurityTripleDES.GetEncryptedText(restaurant.Id);
            thisMenuDTO.ServiceOwnerType = DataSecurityTripleDES.GetEncryptedText((int)OwnerTypeEnum.ServiceProvider);

            DAL.Address address = db.Address.Find(restaurant.AddressId);
            if (address != null)
            {
                AddressDTO addressDTO = EntityDTOHelper.GetEntityDTO <DAL.Address, AddressDTO>(address);
                thisMenuDTO.ServiceOwnerAddressDetail = addressDTO.GetAddressString(true);
            }

            if (thisMenuDTO != null)
            {
                thisMenuDTO.Quantity = 1;

                CraveatsCart craveatsCart = (Session["cart"] == null) ? new CraveatsCart(SessionManager.GetContextSessionLoggedUserID()) : (Session["cart"] as CraveatsCart);
                craveatsCart.AddToCart(thisMenuDTO);

                Session["cart"] = craveatsCart;
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Remove(string id)
        {
            RestaurantMenuCartDTO thisMenuDTO = EntityDTOHelper.GetEntityDTO <RestaurantMenu, RestaurantMenuCartDTO>(menuModel.find(int.Parse(DataSecurityTripleDES.GetPlainText(id))));

            if (thisMenuDTO != null && Session["cart"] != null)
            {
                CraveatsCart craveatsCart = Session["cart"] as CraveatsCart;
                craveatsCart.RemoveItem(id);

                Session["cart"] = craveatsCart;
            }

            return(RedirectToAction("Index"));
        }
        public bool AddToCart(RestaurantMenuCartDTO anItem)
        {
            object xLock     = new object();
            bool   isSuccess = false;

            lock (xLock)
            {
                if (_Items.Any(u => u.Id == anItem.Id))
                {
                    _Items.Find(u => u.Id == anItem.Id).Quantity += anItem.Quantity;
                    isSuccess = true;
                }
                else
                {
                    _Items.Add(anItem);
                    isSuccess = true;
                }
            }
            return(isSuccess);
        }