Add document person creation in admin view.

This commit is contained in:
2020-05-27 22:47:15 +01:00
parent 5b2d9bc995
commit f9935de1b6
7 changed files with 45 additions and 227 deletions

View File

@@ -47,6 +47,20 @@ namespace Marechai.Services
await _context.SaveChangesAsync();
}
public async Task<int> CreateAsync(DocumentPersonViewModel viewModel)
{
var model = new DocumentPerson
{
Alias = viewModel.Alias, Name = viewModel.Name, Surname = viewModel.Surname,
DisplayName = viewModel.DisplayName, PersonId = viewModel.PersonId
};
await _context.AddAsync(model);
await _context.SaveChangesAsync();
return model.Id;
}
public async Task DeleteAsync(int id)
{
DocumentPerson item = await _context.DocumentPeople.FindAsync(id);