コード例 #1
0
        /// <summary>
        /// Save suggestion to the database and to cache.
        /// </summary>
        /// <param name="suggestion"></param>
        /// <returns></returns>
        public Suggestion AddSuggestion(SuggestionDto suggestion)
        {
            var suggestionObject = new Suggestion();

            suggestionObject.FromDto(suggestion);

            // Repository might get a different object back.
            // We will also let repository do the counting
            suggestionObject = PersistSuggestion(suggestionObject);

            var cachedData = GetCachedData();

            cachedData.Insert(suggestionObject);

            return(suggestionObject);
        }