public Attendance(DayActivity dayActivity, User user) { DayId = dayActivity.DayId; ActivityId = dayActivity.ActivityId; UserId = user.UserId; DayActivity = dayActivity; User = user; TimeOfDay = dayActivity.TimeOfDay; }
public void AddDayActivity(DayActivity dayActivity) { if (DayActivities.SingleOrDefault(da => da.DayId == dayActivity.DayId && da.ActivityId == dayActivity.ActivityId && da.TimeOfDay == dayActivity.TimeOfDay) == null) { DayActivities.Add(dayActivity); } else { throw new ArgumentException("DayActivity already exists"); } }
public void RemoveDayActivity(DayActivity dayActivity) { if (DayActivities.SingleOrDefault(da => da.DayId == dayActivity.DayId && da.ActivityId == dayActivity.ActivityId && da.TimeOfDay == dayActivity.TimeOfDay) != null) { DayActivities.Remove(dayActivity); } else { throw new ArgumentException("DayActivity doesn't exist"); } }