// We're gonna take an eventviewmodel (info from 25Live) and a Chapeleventviewmodel (info form our database) // then mash 'em together public AttendedEventViewModel(EventViewModel a, ChapelEventViewModel b) { // First the EventViewModel LiveID = b.LiveID; CHDate = b.CHDate; CHTime = b.CHTime; CHTermCD = b.CHTermCD.Trim(); Required = b.Required; // Then the CHapelEventViewModel if (a != null) { Event_Name = a.Event_Name ?? ""; Event_Title = a.Event_Title ?? ""; Event_Type_Name = a.Event_Type_Name ?? ""; Category_ID = a.Category_Id ?? ""; Description = a.Description ?? ""; Organization = a.Organization ?? ""; Occurrences = a.Occurrences ?? new List <Object[]>(); } // If it's null, fill it with empty strings so we don't crash else { Event_Name = ""; Event_Title = ""; Event_Type_Name = ""; Category_ID = ""; Description = ""; Organization = ""; Occurrences = new List <Object[]>(); } }
// We're gonna take an eventviewmodel (info from 25Live) and a Chapeleventviewmodel (info form our database) // then mash 'em together public AttendedEventViewModel(EventViewModel a, ChapelEventViewModel b) { // First the EventViewModel LiveID = b.LiveID; CHDate = b.CHDate.Value.Add(b.CHTime.Value.TimeOfDay); CHTermCD = b.CHTermCD.Trim(); Required = b.Required; // Then the CHapelEventViewModel if (a != null) { Event_Name = a.Event_Name ?? ""; Event_Title = a.Event_Title ?? ""; Description = a.Description ?? ""; Organization = a.Organization ?? ""; Occurrences = a.Occurrences ?? null; } // If it's null, fill it with empty strings so we don't crash else { Event_Name = ""; Event_Title = ""; Description = ""; Organization = ""; Occurrences = null; } }