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); }
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); }