public static PageSchemaModel GetPageModel(PageSchema page) { if (page == null) return null; var result = new PageSchemaModel {Id = page.Id, IdPerson = page.IdPerson, IdEvent = page.IdEvent, IdHall = page.IdHall, PageType = (int)page.Page}; if (result.IdPerson != null) result.Person = PersonModelHelper.GetPersonModel(page.Person); if (result.IdEvent != null) result.Event = EventModelHelper.GetEventModel(page.Event); //TODO get Hall model return result; }
/// <summary> /// Оборачивает <paramref name="connection"/> в модель /// </summary> /// <param name="connection"></param> /// <returns></returns> public static PersonConnectionModel GetConnectionModel(PersonConnection connection) { return(connection != null ? new PersonConnectionModel { Id = connection.Id, id_ConnectionType = connection.id_ConnectionType, id_Event = connection.id_Event, id_Person = connection.id_Person, id_PersonConnectTo = connection.id_PersonConnectTo, PersonConnectTo = GetPersonModel(connection.PersonConnectTo), Event = EventModelHelper.GetEventModel(connection.Event), PersonConnectionType = connection.PersonConnectionType.Name, Description = connection.Description } : new PersonConnectionModel()); }