AssessmentAnywhere.Services.Assessments.Assessment.SetTotalMarks C# (CSharp) Method

SetTotalMarks() public method

public SetTotalMarks ( decimal totalMarks ) : void
totalMarks decimal
return void
        public void SetTotalMarks(decimal? totalMarks)
        {
            if (totalMarks.HasValue)
            {
                if (totalMarks.Value < 1)
                {
                    throw new ArgumentOutOfRangeException("totalMarks", "Total marks value must be greater than zero.");
                }

                if (this.results.Any(r => r.Result > totalMarks))
                {
                    throw new ArgumentOutOfRangeException(
                        "totalMarks", "All results must be within than the total marks");
                }
            }

            this.TotalMarks = totalMarks;
        }