// store user feedback for this event public async Task <int> SubmitFeedback(int topicId, int rating, string comment) { Console.WriteLine($"** Event Grain SubmitFeedback() topicId = {topicId}, into topic queue length {State.topics.Length+1} "); // check topic is valid if (topicId < 1 || topicId > State.topics.Length) { return(300); } if (State.feedback == null) { State.feedback = new List <FeedbackGrainState>(); // belt and barces in cas efeedback hasn't been initialised } // store feedback FeedbackGrainState f = new FeedbackGrainState(); f.topicId = topicId; f.rating = rating; f.comment = comment; State.feedback.Add(f); Console.WriteLine($"** Event Grain SubmitFeedback() about to write WriteStateAsync for {topicId}, with rating of {rating} {comment}"); await base.WriteStateAsync(); return(200); }
// store user feedback for this event public async Task SubmitFeedback(int topicId, int rating, string comment) { // check topic is valid if (topicId > State.topics.Length) { return; // should we surface error? } // store feedback FeedbackGrainState f = new FeedbackGrainState(); f.topicId = topicId; f.rating = rating; f.comment = comment; State.feedback.Add(f); return; }