public static TableHeaderViewModel ToViewModel(this ScheduleItemAttribute room) { if (room is TimeSlot timeSlot) { return(new TableHeaderViewModel() { Name = room.Name, Description = $"Начало: {timeSlot.Options.StartTime:D}, Продолжительность: {timeSlot.Options.TimeSlotInMinutes} минут<br />" .MarkAsHtmlString() + room.Description.ToHtmlString(), }); } return(new TableHeaderViewModel() { Name = room.Name, Description = room.Description.ToHtmlString() }); }
public static TableHeaderViewModel ToViewModel(this ScheduleItemAttribute scheduleItem) { if (scheduleItem is TimeSlot slot) { return(new TableHeaderViewModel() { Id = slot.Id, Name = slot.Name, Description = $"Начало: {slot.Options.StartTime:D}, Продолжительность: {slot.Options.TimeSlotInMinutes} минут<br />" .MarkAsHtmlString() + scheduleItem.Description.ToHtmlString(), }); } if (scheduleItem is ScheduleRoom room) { return(new TableHeaderViewModel() { Id = room.Id, Name = room.Name, Description = room.Description.ToHtmlString() }); } throw new NotImplementedException(); }