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
namespace NameIt | |
{ | |
public static class AwsCostExplorer | |
{ | |
private const string metricType = "BlendedCost"; | |
private static readonly RegionEndpoint regionEndpoint = RegionEndpoint.USEast1; | |
public static AwsCostStructure GetCostForAccount(string accessKey, string secretKey, Period period) | |
{ | |
var client = new AmazonCostExplorerClient( |
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
$('form[data-async=true]').on('submit', function (event) { | |
var $form = $(this); | |
var $target = $($form.attr('data-target')); | |
$.ajax({ | |
type: $form.attr('method'), | |
url: $form.attr('action'), | |
data: $form.serialize(), | |
success: function (data, status) { |
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
// Repository | |
public class CustomerRepository : ICustomerRepository | |
{ | |
public Customer Get(Guid id) { ... } | |
public List<Customer> GetAll() { ... } | |
public Add(Customer customer) { ... } | |
public Update(Customer customer) { ... } | |
public Delete(Customer customer) { ... } | |
} | |
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 class Customer : Entity | |
{ | |
public Guid Id { get; set; } | |
public string Name { get; set; } | |
public DateTime BirthDate { get; set; } | |
public CustomerLevel Level { get; set; } | |
} | |
public class CustomerViewModel | |
{ |
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
[HttpPut("customers")] | |
public JsonResult UpdateCustomer(Customer customer) | |
{ | |
if (ModelState.IsValid) | |
{ | |
// Consumers are able to set Customer.Level as they can do with every other property added now and in the future. | |
customerRepository.Update(customer); | |
return Ok(); | |
} |
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
{ | |
"id": "d3edcff2-072c-41eb-b83e-6a0f795fa83a", | |
"name": "John Doe", | |
"birthDate": "1980-05-03", | |
"level": "Basic" | |
} |
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 class Customer : Entity | |
{ | |
[Id] | |
public Guid Id { get; set; } | |
[Required] | |
[MaxLength(50) | |
public string Name { get; set; } | |
public DateTime BirthDate { get; set; } |
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
{ | |
"id": "d3edcff2-072c-41eb-b83e-6a0f795fa83a", | |
"name": "John Doe", | |
"isAdvanced": false | |
} |
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
[HttpGet("customers/{id}")] | |
public IActionResult GetCustomer(Guid id) | |
{ | |
var model = customerRepository.Get(id); | |
return Ok(model); | |
} |
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 class Customer : Entity | |
{ | |
public Guid Id { get; set; } | |
public string Name { get; set; } | |
public bool IsAdvanced { get; set; } | |
} |