Created
January 15, 2022 13:00
-
-
Save enisn/6df1dce4e8547e739665f19704b26345 to your computer and use it in GitHub Desktop.
Mastering at Source Generators - Extending TodoController via partial class
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
using Microsoft.AspNetCore.Mvc; | |
namespace Awesome.Api.Controllers; | |
public partial class TodoController | |
{ | |
[HttpPut("mark-all-as-completed")] | |
public async Task MarkAllAsCompletedAsync() | |
{ | |
var todos = await _repository.GetListAsync(); | |
foreach (var todo in todos.Where(x => !x.IsCompleted)) | |
{ | |
await _repository.UpdateAsync(todo.Id, todo); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment