/// <summary> /// お知らせを変更します。 /// </summary> /// <param name="title">お知らせタイトル。</param> /// <param name="body">お知らせ本文。</param> /// <param name="announcementGenre">お知らせ種別。</param> /// <param name="enddate">終了日。</param> public void Change(AnnouncementTitle title, string body, AnnouncementGenre announcementGenre, EndDate enddate) { this.AnnounceTitle = title; this.Body = body; this.AnnouncementGenre = announcementGenre; this.EndDate = enddate; }
/// <summary> /// お知らせの新しいインスタンスを生成します。 /// </summary> /// <param name="announceTitle">お知らせタイトル。</param> /// <param name="body">お知らせ本文。</param> /// <param name="announcementGenre">お知らせ種別。</param> /// <param name="registeredDate">登録日。</param> /// <param name="endDate">終了日。</param> /// <param name="attachedFilePath">添付ファイルパス。</param> public Announcement(AnnouncementTitle announceTitle, string body, AnnouncementGenre announcementGenre, RegisteredDate registeredDate, EndDate endDate, AttachedFilePath attachedFilePath) { this.AnnounceTitle = announceTitle ?? throw new ArgumentNullException("お知らせタイトル"); this.Body = body; this.AnnouncementGenre = announcementGenre = announcementGenre ?? throw new ArgumentNullException("お知らせ種別");; this.RegisteredDate = registeredDate ?? throw new ArgumentNullException("登録日"); if (endDate != null) { this.EnsureValidEndDates(this.RegisteredDate, endDate); } this.EndDate = endDate; this.AttachedFilePath = attachedFilePath; }