Example #1
0
        public StudentWeight Update(StudentWeight studentWeight, Student student, double weight)
        {
            if (studentWeight == null)
            {
                throw new ArgumentNullException("studentId cannot be empty");
            }

            if (weight < 0)
            {
                throw new Exception("weight cannot be negative");
            }

            studentWeight.Student   = student;
            studentWeight.Weight    = weight;
            studentWeight.UpdatedAt = DateTime.UtcNow;

            return(studentWeight);
        }
Example #2
0
        public StudentWeight Create(Student student, double weight)
        {
            if (student == null)
            {
                throw new ArgumentNullException("studentId cannot be empty");
            }

            if (weight < 0)
            {
                throw new Exception("weight cannot be negative");
            }

            StudentWeight studentWeight = new StudentWeight()
            {
                Id        = Guid.NewGuid(),
                Student   = student,
                Weight    = weight,
                CreatedAt = DateTime.UtcNow,
                UpdatedAt = DateTime.UtcNow
            };

            return(studentWeight);
        }