Spontaneous.WebApp.Models.MenuCopyModel.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            string strRest = (RestaurantsList == null ? "Empty" : RestaurantsList.ToString());
            string strRestSelectList = (RestaurantsList == null ? "Empty" : RestaurantsList.ToString());
            string strSelectedRestListTo = (RestaurantsSelectedListCopyTo == null ? "Empty" : RestaurantsSelectedListCopyTo.Count.ToString());
            string strSelectedRestListFrom = (RestaurantsSelectedListCopyFrom == null ? "Empty" : RestaurantsSelectedListCopyFrom.Count.ToString());
            return string.Format(" MenuCopy: CopyFromId={0}, CopyToId={1}, SelectedCopyFromListCopyFromCount={2}, SelectedCopytoListCopytoCount={3}.",
                CopyFromId, CopyToId, strSelectedRestListFrom, strSelectedRestListTo, strRest);
        }

Usage Example

Example #1
0
        public void MenuClone(MenuCopyModel menuCopy)
        {
            log.DebugFormat("[MenuClone] menuCopy={0}.", menuCopy.ToString());
            if (menuCopy.CopyFromId == null) menuCopy.CopyFromId = menuCopy.RestaurantsSelectedListCopyFrom[0];
            RestaurantBasicData restCloneFrom = GetRestaurantBasicById(menuCopy.CopyFromId);

            foreach (var restId in menuCopy.RestaurantsSelectedListCopyTo)
            {
                if (menuCopy.CopyFromId != restId)
                {
                    RestaurantBasicData restCloneTo = GetRestaurantBasicById(restId);
                    restCloneTo.MenuClone(restCloneFrom);
                    UpdateRestaurant(restCloneTo);

                }
            }
        }