diff --git a/CSETWebApi/CSETWebCore.AutoResponder/Program.cs b/CSETWebApi/CSETWebCore.AutoResponder/Program.cs index ce0c8b4859..2e8885c343 100644 --- a/CSETWebApi/CSETWebCore.AutoResponder/Program.cs +++ b/CSETWebApi/CSETWebCore.AutoResponder/Program.cs @@ -82,13 +82,17 @@ public void ProcessEmails() { ExcelProcess excel = new ExcelProcess(); +#pragma warning disable CS8604 // Possible null reference argument. string path = excel.BuildSheet(_context, configuration.GetValue("ExcelWorkBookPassword")); + foreach(var email in configuration.GetSection("Notifications:Weekly").GetChildren()) { + _emailHelper.SendWeekly(path, email.GetValue("email"), email.GetValue("FirstName"), email.GetValue("LastName")); +#pragma warning restore CS8604 // Possible null reference argument. } diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Assessment/ACETAssessmentBusiness.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Assessment/ACETAssessmentBusiness.cs index 038013ea8d..de651e6193 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Assessment/ACETAssessmentBusiness.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Assessment/ACETAssessmentBusiness.cs @@ -4,7 +4,6 @@ // // //////////////////////////////// -using CSETWebCore.Business.Aggregation; using CSETWebCore.DataLayer.Model; using CSETWebCore.Interfaces; using CSETWebCore.Interfaces.Assessment; diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Contact/ContactBusiness.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Contact/ContactBusiness.cs index b0ca3e3b41..6be742e774 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Contact/ContactBusiness.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Contact/ContactBusiness.cs @@ -169,8 +169,6 @@ where ac.FirstName.Contains(searchParms.FirstName) /// /// Connects an existing USER to an existing ASSESSMENT for the specified role. - /// TODO: Enforce no duplicates - a user should only be connected once. - /// If a new role is supplied, update the existing ASSESSMENT_CONTACTS role. /// public ContactDetail AddContactToAssessment(int assessmentId, int userId, int roleid, bool invited) { diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Demographic/DemographicBusiness.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Demographic/DemographicBusiness.cs index ac31debf25..53b3bfa530 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Demographic/DemographicBusiness.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Demographic/DemographicBusiness.cs @@ -157,8 +157,6 @@ public int SaveDemographics(Demographics demographics) dbDemographics.OrganizationType = demographics.OrganizationType == 0 ? null : demographics.OrganizationType; dbDemographics.OrganizationName = demographics.OrganizationName; - // TODO: dbDemographics.OrgPointOfContact = demographics.OrgPointOfContact == 0 ? null : demographics.OrgPointOfContact; - _context.DEMOGRAPHICS.Update(dbDemographics); _context.SaveChanges(); diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Diagram/DiagramManager.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Diagram/DiagramManager.cs index b36f1ea860..27c3de23b9 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Diagram/DiagramManager.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Diagram/DiagramManager.cs @@ -489,7 +489,7 @@ public List ProcessDiagramEdges(StringReader stream, int return edges; } - //TODO check to see if this is still the same + /// /// /// @@ -501,16 +501,6 @@ public LayerVisibility getLayerVisibility(string drawIoId, int assessment_id) //get the parent id var lm = new LayerManager(_context, assessment_id); var list = lm.GetLastLayer(drawIoId); - - //Dictionary allItems = list.ToDictionary(x => x.DrawIo_id, x => x); - //LayerVisibility layer = new LayerVisibility(); - //LayerVisibility lastLayer = new LayerVisibility(); - //while (!string.IsNullOrEmpty(drawIoId) && allItems.TryGetValue(drawIoId, out layer)) - //{ - // lastLayer = layer; - // drawIoId = layer.Parent_DrawIo_id; - //} - return list; } diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Diagram/analysis/NetworkComponent.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Diagram/analysis/NetworkComponent.cs index e160973a91..6213b329c0 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Diagram/analysis/NetworkComponent.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Diagram/analysis/NetworkComponent.cs @@ -33,9 +33,6 @@ public bool IsFirewall { get public bool IsIDSOrIPS { get { - //TODO if this is an MSC - //look to see if the MSC contains - //an ips or ids return this.Component_Symbol_Id == Constants.Constants.IDS_TYPE || this.Component_Symbol_Id == Constants.Constants.IPS_TYPE; } diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Framework/FrameworkBusiness.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Framework/FrameworkBusiness.cs index 2b471a1a1c..d1c3fb127e 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Framework/FrameworkBusiness.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Framework/FrameworkBusiness.cs @@ -36,10 +36,6 @@ public FrameworkResponse GetFrameworks(int assessmentId) // get any existing answers for this assessment var answers = _context.FRAMEWORK_TIER_TYPE_ANSWER.Where(ans => ans.Assessment_Id == assessmentId); - // TODO: If we add a 'sequence' column to this table, we can sort the sections - // because they appear in a different order in CSET 8.1. Does the order even matter? - - foreach (FRAMEWORK_TIER_TYPE ftt in _context.FRAMEWORK_TIER_TYPE.ToList()) { FrameworkTierType f = new FrameworkTierType() diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/ModuleBuilder/ModuleBuilderBusiness.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/ModuleBuilder/ModuleBuilderBusiness.cs index 36b69bca02..80ab349b82 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/ModuleBuilder/ModuleBuilderBusiness.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/ModuleBuilder/ModuleBuilderBusiness.cs @@ -627,8 +627,6 @@ public void AddCustomQuestion(SetQuestion request) NEW_QUESTION q = new NEW_QUESTION { Simple_Question = request.CustomQuestionText, - - // TODO: std_ref + std_ref_number must be unique Std_Ref = request.SetName, Std_Ref_Number = newStdRefNum, @@ -1562,8 +1560,6 @@ public Requirement UpdateRequirement(Requirement parms) /// /// Removes the NEW_REQUIREMENT record from the set. - /// - /// TODO: Actually delete the NEW_REQUIREMENT record? /// /// public void RemoveRequirement(Requirement parms) diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Question/QuestionPoco.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Question/QuestionPoco.cs index e257042204..bfca9fbde2 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Question/QuestionPoco.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Question/QuestionPoco.cs @@ -545,8 +545,7 @@ public int FindingCount } - /// - /// TODO: Do we need to deal with Requirements Mode?? + /// /// private String categoryAndQuesitonNumber; public String CategoryAndQuestionNumber diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Question/QuestionRequirementManager.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Question/QuestionRequirementManager.cs index e7a04f8207..36bb4d5754 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Question/QuestionRequirementManager.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Question/QuestionRequirementManager.cs @@ -545,10 +545,7 @@ public string DetermineQuestionType(bool is_requirement, bool is_component, bool /// /// Returns the number of questions that are relevant for the selected standards - /// when in REQUIREMENTS mode. - /// - /// TODO: This query is a copy of the one above. Find a way to have a single copy of the query - /// that can be used for full queries or counts or whatever. + /// when in REQUIREMENTS mode. /// /// public int NumberOfRequirements() @@ -572,8 +569,6 @@ where SetNames.Contains(rs.Set_Name) /// /// The query differs whether a single or multiple standards are selected. /// - /// TODO: These queries are copies of the ones above. Find a way to have a single instance of each query - /// that can be used for both full data queries and counts in an efficient way. /// /// public int NumberOfQuestions() diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Reports/ReportsDataBusiness.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Reports/ReportsDataBusiness.cs index 75bd2b0746..80f7b117c1 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Reports/ReportsDataBusiness.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Reports/ReportsDataBusiness.cs @@ -288,7 +288,6 @@ from b in _context.VIEW_QUESTIONS_STATUS.Where(x => x.Answer_Id == a.Answer_Id). var maturityDomains = new List(); - // ToDo: Refactor the following stucture of loops foreach (var domain in questionGrouping.SubGroupings) { var newDomain = new MatAnsweredQuestionDomain() diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Sal/GeneralSalBusiness.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Sal/GeneralSalBusiness.cs index bfbd1eeae6..c02237a570 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Sal/GeneralSalBusiness.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Sal/GeneralSalBusiness.cs @@ -82,7 +82,7 @@ private double GetOverallSALWeight(List weights) //currently selected items can be retrieved from the database double weight = 0; foreach (GEN_SAL_WEIGHTS mapping in weights) - { // TODO: probably better to iterate through the children on the page but dictionary works for now. + { weight += (double)mapping.Weight; } diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Standards/StandardRepository.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Standards/StandardRepository.cs index d5b503875a..b5b73b15b7 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Standards/StandardRepository.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Standards/StandardRepository.cs @@ -324,13 +324,7 @@ public StandardModeEnum StandardMode get { return standardMode; } set { standardMode = value; } } - public StandardModeEnum GetRecommendedMode() - { - //TODO: Implement - - return StandardModeEnum.Question; - } - + private LevelManager levelManager; private STANDARD_SELECTION standard = null; diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/User/UserBusiness.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/User/UserBusiness.cs index 1e04989093..7aa55e28db 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/User/UserBusiness.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.Business/User/UserBusiness.cs @@ -83,9 +83,7 @@ public UserCreateResponse CreateUser(UserDetail userDetail, CSETContext tmpConte throw; } - - //TODO: Add logging - Console.WriteLine(ex); + NLog.LogManager.GetCurrentClassLogger().Error(ex); tmpContext.USERS.Remove(u); } diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.BusinessTests/Maturity/MaturityBusinessTests.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.BusinessTests/Maturity/MaturityBusinessTests.cs index 03205ef12a..33b205b17f 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.BusinessTests/Maturity/MaturityBusinessTests.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.BusinessTests/Maturity/MaturityBusinessTests.cs @@ -20,7 +20,7 @@ namespace CSETWebCore.Business.Maturity.Tests [TestClass()] public class MaturityBusinessTests { - private CSETContext context; + private CSETContext? context; [TestInitialize()] public void Initialize() diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.DatabaseManagerTests1/DbManagerTests.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.DatabaseManagerTests1/DbManagerTests.cs index d921027543..7aecec8798 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.DatabaseManagerTests1/DbManagerTests.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.DatabaseManagerTests1/DbManagerTests.cs @@ -69,10 +69,16 @@ public void TestUpgrade() string clientCode = "Test"; string appCode = "Test"; DbManager manager = new DbManager(new Version("12.0.3.2"), clientCode, appCode); - + //manager.ForceCloseAndDetach(DbManager.localdb2019_ConnectionString, "TestWeb"); //manager.AttachTest("TestWeb", testdb, testlog); + +#pragma warning disable IDE0090 // Use 'new(...)' +#pragma warning disable CS8602 // Dereference of a possibly null reference. VersionUpgrader upgrader = new VersionUpgrader(Assembly.GetAssembly(typeof(DbManager)).Location); +#pragma warning restore CS8602 // Dereference of a possibly null reference. +#pragma warning restore IDE0090 // Use 'new(...)' + manager.SetupDb(); upgrader.UpgradeOnly(new Version("12.0.3.2"), "data source=(localdb)\\mssqllocaldb;initial catalog=TestWeb;persist security info=True;Integrated Security=SSPI;MultipleActiveResultSets=True"); diff --git a/CSETWebApi/CSETWeb_Api/CSETWebCore.DatabaseManagerTests1/ImportExportTests.cs b/CSETWebApi/CSETWeb_Api/CSETWebCore.DatabaseManagerTests1/ImportExportTests.cs index 23214b6b9b..4ba891ebdd 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWebCore.DatabaseManagerTests1/ImportExportTests.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWebCore.DatabaseManagerTests1/ImportExportTests.cs @@ -38,11 +38,11 @@ namespace CSETWebCore.DatabaseManager.Tests [TestClass()] public class ImportExportTests { - private CSETContext context; - private TokenManager tokenManager; - private LocalInstallationHelper localHelper; - private PasswordHash passwordHash; - private IConfiguration config; + private CSETContext? context; + private TokenManager? tokenManager; + private LocalInstallationHelper? localHelper; + private PasswordHash? passwordHash; + private IConfiguration? config; [TestInitialize()] public void Initialize() @@ -78,18 +78,17 @@ public void ImportAllAssessmentsTest() public void ExportAllAssessmentsTest() { //setup a copy file - //setup a destination file - string clientCode = "DHS"; - string appCode = "CSET"; - + //setup a destination file UserAuthentication userAuth = new UserAuthentication(passwordHash, null, localHelper, tokenManager, null, config, context); Login login = new Login { Email = null, Password = null, TzOffset = "300", Scope = "CSET" }; string loginToken = userAuth.AuthenticateStandalone(login, tokenManager).Token; +#pragma warning disable CS8602 // Dereference of a possibly null reference. var assessments = context.ASSESSMENTS.Select(x => x.Assessment_Id).AsEnumerable(); +#pragma warning restore CS8602 // Dereference of a possibly null reference. - for( int i=0; i - /// Gets the path to the Legacy CSET Import process. Checks for both dev and production versions. - /// - /// - private string GetLegacyImportProcessPath() - { - var dir = new FileInfo(AppDomain.CurrentDomain.BaseDirectory).Directory; - - // TODO: Problem: These paths create a dependency and should be some sort of variable for installation as well as debugging. - // Also, can the user change the installation directory? If so, this gets messed up... - var importFile = dir.Parent.Parent.Parent.Parent.FullName + "\\CSETStandAlone\\LegacyCSETImport\\Bin\\Debug\\LegacyCSETImport.exe"; - var importProductionFile = Path.Combine(dir.Parent.FullName, "LegacyCSETImport.exe"); - - var path = string.Empty; - if (System.IO.File.Exists(importFile)) - { - path = importFile; - } - else if (System.IO.File.Exists(importProductionFile)) - { - path = importProductionFile; - } - return path; - } - - - private bool LegacyImportProcessExists() - { - var processPath = GetLegacyImportProcessPath(); - var processExists = !string.IsNullOrEmpty(processPath); - return processExists; - } - - [HttpGet] // [CSETAuthorize] [Route("api/assessment/legacy/import/installed")] public IActionResult LegacyImportIsInstalled() { - return Ok(LegacyImportProcessExists()); + return Ok(false); } diff --git a/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/GeneralSalController.cs b/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/GeneralSalController.cs index c68e2b4130..ce25a22989 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/GeneralSalController.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/GeneralSalController.cs @@ -47,7 +47,6 @@ public IActionResult GetGeneralSalDescriptionsWeights() { int assessmentid = _token.AssessmentForUser(); - //TODO: make this async TinyMapper.Bind(); TinyMapper.Bind(); diff --git a/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/MaturityController.cs b/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/MaturityController.cs index 7ca0e74c70..94736d09a8 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/MaturityController.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/MaturityController.cs @@ -439,13 +439,6 @@ public IActionResult GetSectionScoring() public IActionResult ImportSurvey([FromBody] Model.Nested.CisImportRequest request) { var assessmentId = _tokenManager.AssessmentForUser(); - - - // TODO: verify that the user has permission to both assessments - - - - var biz = new CisQuestionsBusiness(_context, _assessmentUtil, assessmentId); biz.ImportCisAnswers(request.Dest, request.Source); return Ok(); diff --git a/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/NcuaController.cs b/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/NcuaController.cs index 9dc349f872..ab49540bcc 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/NcuaController.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/NcuaController.cs @@ -53,11 +53,7 @@ public IActionResult GetQuestionText([FromQuery] int modelId) { [Route("api/getMergeData")] public IList GetMergeAnswers([FromQuery] int id1, [FromQuery] int id2, [FromQuery] int id3, [FromQuery] int id4, [FromQuery] int id5, [FromQuery] int id6, [FromQuery] int id7, [FromQuery] int id8, [FromQuery] int id9, [FromQuery] int id10) - { - // Todo: Add security check for authorization - // Call assessments for user on each assessment ID - - // if true + { return _context.Get_Merge_Conflicts(id1, id2, id3, id4, id5, id6, id7, id8, id9, id10); } diff --git a/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/ReferenceDocumentsController.cs b/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/ReferenceDocumentsController.cs index 4c3727b197..7e34315924 100644 --- a/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/ReferenceDocumentsController.cs +++ b/CSETWebApi/CSETWeb_Api/CSETWeb_ApiCore/Controllers/ReferenceDocumentsController.cs @@ -102,94 +102,5 @@ from ft in tt.DefaultIfEmpty() return new NotFoundResult(); } - - - [HttpPost] - [CsetAuthorize] - [Route("api/ReferenceDocuments")] - -#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously - public async Task Post(IFormFile formFile) -#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously - { - try - { - //TODO:File upload - //// Check if the request contains multipart/form-data. - //if (formFile == null) - //{ - // return BadRequest("Could not upload file"); - - //} - //var provider = new InMemoryMultipartFormDataStreamProvider(); - //await Request.Content.ReadAsMultipartAsync(provider); - - - ////access form data - //var formData = provider.FormData; - //var file = provider.Files.First(); - - //var serializer = new JavaScriptSerializer(); - //var expando = new ExpandoObject(); - //foreach (var item in formData.AllKeys) - //{ - // ((IDictionary)expando)[item] = formData[item]; - //} - //var formDocument = serializer.ConvertToType(expando); - //formDocument.Data = await file.ReadAsByteArrayAsync(); - //formDocument.FileSize = file.Headers.ContentLength; - //formDocument.FileName = UnquoteToken(file.Headers.ContentDisposition.FileName); - //var genFile = formDocument.ToGenFile(); - //var extension = Path.GetExtension(genFile.File_Name).Substring(1); - //var response = Request.CreateResponse(HttpStatusCode.OK); - - //var existingFiles = _context.GEN_FILE.Where(s => s.File_Name == genFile.File_Name && (s.Is_Uploaded ?? false)).ToList(); - //if (existingFiles.Any(s => s.Doc_Num == genFile.Doc_Num)) - //{ - // var existingFile = existingFiles.FirstOrDefault(s => s.Doc_Num == genFile.Doc_Num); - // existingFile.Data = genFile.Data; - // await _context.SaveChangesAsync(); - // return response; - //} - //else if (existingFiles.Any()) - //{ - // return Request.CreateErrorResponse(HttpStatusCode.BadRequest, new Exception("Document could not be added. Please change the file name and try again")); - //} - //genFile.File_Type_ = _context.FILE_TYPE.Where(s => s.File_Type1 == extension).FirstOrDefault(); - //try - //{ - // _context.FILE_REF_KEYS.Add(new FILE_REF_KEYS { Doc_Num = genFile.Doc_Num }); - // await _context.SaveChangesAsync(); - //} - //catch - //{ - //} - //_context.GEN_FILE.Add(genFile); - //await _context.SaveChangesAsync(); - - - // return response; - return Ok(); - } - catch (Exception e) - { - return BadRequest(e); - - } - } - private static string UnquoteToken(string token) - { - if (String.IsNullOrWhiteSpace(token)) - { - return token; - } - - if (token.StartsWith("\"", StringComparison.Ordinal) && token.EndsWith("\"", StringComparison.Ordinal) && token.Length > 1) - { - return token.Substring(1, token.Length - 2); - } - - return token; - } } }