This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class WebApiHelpers | |
{ | |
public static string ToJson(Object model) | |
{ | |
var serializerSettings = new JsonSerializerSettings | |
{ | |
ContractResolver = new CamelCasePropertyNamesContractResolver() | |
}; | |
return JsonConvert.SerializeObject(model, serializerSettings); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ids = @"1,2 | |
3 | |
asf | |
4 5"; | |
Regex rx = new Regex(@"(\d+)", | |
RegexOptions.Compiled | RegexOptions.IgnoreCase); | |
MatchCollection matches = rx.Matches(ids); | |
var listIds = new List<int>(); | |
foreach (Match match in matches) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Old | |
function handleErrors(response) { | |
if (!response.ok) { | |
throw Error(response.statusText); | |
} | |
return response; | |
} | |
// GET | |
fetch(`/myAPI/GetMethod?param=${this.param}`, { |