EFCoreWebAPI.Controllers.WeatherController.GetAndUpdateMostCommonWord C# (CSharp) Method

GetAndUpdateMostCommonWord() private method

private GetAndUpdateMostCommonWord ( int eventId ) : string
eventId int
return string
        public string GetAndUpdateMostCommonWord(int eventId)
        {
            //This contoller method demonstrates the NEW BEHAVIOR of DbContext.Entry.State
            //which will only affect the root of the graph passed in
            var eventGraph = _repo.GetWeatherEventAndReactionsById(eventId);
            var theWord = ReactionParser.MostFrequentWord(
                eventGraph.Reactions.Select(r => r.Quote).ToList());
            eventGraph.MostCommonWord = theWord;
            _repo.UpdateWeatherEventOnly(eventGraph);
            Console.WriteLine($"NOTE: Graph still has {eventGraph.Reactions.Count} reactions attached");
            return theWord;
        }