This file contains 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
@page "/" | |
<input bind="@SearchTerm" /> | |
<span class="text-muted ml-5"> | |
Showing @FilteredToDos.Count out of @ToDoItems.Count | |
</span> | |
<h4 class="mt-4">To Do's</h4> | |
<ul> |
This file contains 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
@page "/" | |
<input @bind="SearchTerm" @bind:event="oninput" /> | |
<span class="text-muted ml-5"> | |
Showing @FilteredToDos.Count out of @ToDoItems.Count | |
</span> | |
<h4 class="mt-4">To Do's</h4> | |
<ul> |
This file contains 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
[HttpPost("Download/{id:guid}")] | |
[ValidateAntiForgeryToken] | |
public async Task<IActionResult> Download(Guid id) | |
{ | |
// Retrieve some file from some service | |
ApplicationFile file = await _fileService.GetFileAsync(id); | |
string extension = Path.GetExtension(file.NameWithExtension); | |
string contentType = ""; |
This file contains 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
[HttpPost("Download/{id:guid}")] | |
[ValidateAntiForgeryToken] | |
public async Task<IActionResult> Download(Guid id) | |
{ | |
// Retrieve some file from some service | |
ApplicationFile file = await _fileService.GetFileAsync(id); | |
var fileProvider = new FileExtensionContentTypeProvider(); | |
// Figures out what the content type should be based on the file name. | |
if (!fileProvider.TryGetContentType(file.NameWithExtension, out string contentType)) |
This file contains 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
[Route("File")] | |
public class FileController : Controller | |
{ | |
private readonly IFileService _fileService; | |
public FileController(IFileService fileService) | |
{ | |
_fileService = fileService; | |
} |
This file contains 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
[Route("File")] | |
public class FileController : Controller | |
{ | |
[HttpPost("Download/{id:guid}")] | |
[ValidateAntiForgeryToken] | |
public async Task<IActionResult> Download(Guid id) | |
{ | |
// Grab a test.pdf back one directory. Look ma - it even runs on Linux with Path.DirectorySeparatorChar! | |
var fileContent = await File.ReadAllBytesAsync($"..{Path.DirectorySeparatorChar}test.pdf"); | |
This file contains 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
[Route("File")] | |
public class FileController : Controller | |
{ | |
private readonly IFileService _fileService; | |
public FileController(IFileService fileService) | |
{ | |
_fileService = fileService; | |
} |
This file contains 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 Program | |
{ | |
public static void Main(string[] args) | |
{ | |
CreateWebHostBuilder(args).Run(); | |
} | |
public static IWebHost CreateWebHostBuilder(string[] args) | |
{ | |
var hostBuilder = WebHost.CreateDefaultBuilder(args) |
This file contains 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
const firstArray = [ 1, 2, 3]; // Prettier will still format this line with its defaults | |
// prettier-ignore | |
const secondArray = [ | |
4, | |
5, | |
6 | |
]; | |
const somethingElse = 'blah'; |
This file contains 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 | |
{ | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
public string ZipCode { get; set; } | |
} | |
public List<Customer> GetCustomersByState(string state) | |
{ | |
var dbConnection = new SqlConnection("SomeConnectionString"); |