This commit is contained in:
Natlinux
2022-11-13 18:10:38 +01:00
parent d2c021c5b7
commit ee8c687f5c
13 changed files with 380 additions and 8 deletions

View File

@@ -0,0 +1,34 @@
using Apollon.Domain.Commands;
using Apollon.EntityFramework.DTOs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.EntityFramework.Commands
{
public class DeleteNameListCommand : IDeleteNameListCommand
{
private readonly ApplicationDBContextFactory _contextFactory;
public DeleteNameListCommand(ApplicationDBContextFactory contextFactory)
{
_contextFactory = contextFactory;
}
public async Task Execute(Guid id)
{
using (ApplicationDbContext context = _contextFactory.Create())
{
NameListDto nameListDto = new NameListDto()
{
Id = id,
};
context.NameList.Remove(nameListDto);
await context.SaveChangesAsync();
}
}
}
}