public static string GetAssetsView(RestCommand command) { AssetsView assetsView = new AssetsView(command.LoginUser); try { assetsView.LoadByOrganizationID(command.Organization.OrganizationID, command.Filters); } catch (Exception ex) { //if something fails use the old method assetsView.LoadByOrganizationID(command.Organization.OrganizationID); ExceptionLogs.LogException(command.LoginUser, ex, "API", "RestAssetsView. GetAssetsView(). SQL filtering generation failed, fell into old method."); } return(assetsView.GetXml("Assets", "Asset", true, command.Filters)); }
public static string GetAssetsView(RestCommand command) { AssetsView assetsView = new AssetsView(command.LoginUser); assetsView.LoadByOrganizationID(command.Organization.OrganizationID); if (command.Format == RestFormat.XML) { return(assetsView.GetXml("AssetsView", "AssetsViewItem", true, command.Filters)); } else { throw new RestException(HttpStatusCode.BadRequest, "Invalid data format"); } }