public static string GetItems(RestCommand command, int organizationID, bool orderByDateCreated = false) { if (Organizations.GetOrganization(command.LoginUser, organizationID).ParentID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } ContactsView items = new ContactsView(command.LoginUser); if (orderByDateCreated) { items.LoadByOrganizationID(organizationID, "DateCreated DESC"); } else { items.LoadByOrganizationID(organizationID); } return(items.GetXml("Contacts", "Contact", true, command.Filters)); }
public static string GetContactsView(RestCommand command) { ContactsView contactsView = new ContactsView(command.LoginUser); contactsView.LoadByOrganizationID(command.Organization.OrganizationID); if (command.Format == RestFormat.XML) { return(contactsView.GetXml("ContactsView", "ContactsViewItem", true, command.Filters)); } else { throw new RestException(HttpStatusCode.BadRequest, "Invalid data format"); } }