Renamed testing projects

This commit is contained in:
2024-12-10 16:55:36 +01:00
parent ee7bf1e204
commit 5f746e0bc1
34 changed files with 27 additions and 27 deletions

View File

@@ -0,0 +1,31 @@
using HopFrame.Web.Admin;
using Microsoft.EntityFrameworkCore;
using HopFrame.Testing.Api.Models;
namespace HopFrame.Testing.Web.Providers;
public class EmployeeProvider(DatabaseContext context) : ModelProvider<Employee> {
public override async Task<IEnumerable<Employee>> ReadAll() {
return await context.Employees
.Include(e => e.Address)
.ToArrayAsync();
}
public override async Task<Employee> Create(Employee model) {
await context.Employees.AddAsync(model);
await context.SaveChangesAsync();
return model;
}
public override async Task<Employee> Update(Employee model) {
context.Employees.Update(model);
await context.SaveChangesAsync();
return model;
}
public override async Task Delete(Employee model) {
context.Employees.Remove(model);
await context.SaveChangesAsync();
}
}