Skip to content

Instantly share code, notes, and snippets.

@enisn
Created January 15, 2022 13:00
Show Gist options
  • Save enisn/6df1dce4e8547e739665f19704b26345 to your computer and use it in GitHub Desktop.
Save enisn/6df1dce4e8547e739665f19704b26345 to your computer and use it in GitHub Desktop.
Mastering at Source Generators - Extending TodoController via partial class
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