public static Conference RefreshConference(Conference conference, ConferenceDTO detail) { if (conference == null) { throw new ArgumentNullException(nameof(conference)); } if (detail == null) { throw new ArgumentNullException(nameof(detail)); } conference.Name = detail.Name; conference.StartDateTime = !string.IsNullOrEmpty(detail.StartTime) ? Convert.ToDateTime(detail.StartTime) : conference.StartDateTime; conference.EndDateTime = !string.IsNullOrEmpty(detail.EndTime) ? Convert.ToDateTime(detail.EndTime) : conference.EndDateTime; conference.DefaultDurationMinutes = detail.DefaultDuration.HasValue ? detail.DefaultDuration.Value : conference.DefaultDurationMinutes; conference.DefaultStartTime = !string.IsNullOrEmpty(detail.DefaultStart) ? detail.DefaultStart : conference.DefaultStartTime; return(conference); }
public static Conference BuildConference(ConferenceDTO detail, int branchId, string confId = null) { if (detail == null) { throw new ArgumentNullException(nameof(detail)); } var newConf = new Conference { Name = detail.Name, StartDateTime = Convert.ToDateTime(detail.StartTime), EndDateTime = Convert.ToDateTime(detail.EndTime), BranchId = branchId, DefaultStartTime = detail.DefaultStart, DefaultDurationMinutes = detail.DefaultDuration }; if (!string.IsNullOrEmpty(confId)) { newConf.Id = Int32.Parse(confId); } return(newConf); }