コード例 #1
0
        public void AddOrUpdateResult(Guid testID, Guid categoryID, bool passed, string notes = "")
        {
            _resultsList = GetResults();

            var existing = _resultsList.FirstOrDefault(r => r.TestID == testID);

            if (existing == null)
            {
                var result = new ScorecardTestResultModel
                {
                    ProgressID = ID,
                    TestID     = testID,
                    CategoryID = categoryID,
                    Passed     = passed,
                };

                _resultsList.Add(result);
            }
            else
            {
                existing.Passed = passed;

                if (!string.IsNullOrEmpty(notes))
                {
                    existing.Notes = notes;
                }
            }

            ResultsJson = JsonConvert.SerializeObject(_resultsList);
        }
コード例 #2
0
        void AddOrUpdateResult(ScorecardTestResultModel result)
        {
            _resultsList = GetResults();

            var existing = _resultsList.FirstOrDefault(r => r.TestID == result.TestID);

            if (existing == null)
            {
                _resultsList.Add(result);
            }
            else
            {
                existing.Passed = result.Passed;
                existing.Notes  = result.Notes;
            }

            ResultsJson = JsonConvert.SerializeObject(_resultsList);
        }