3using Microsoft.EntityFrameworkCore;
53 throw new InvalidOperationException($
"Region name already exist");
56 await
_db.SaveChangesAsync();
70 throw new InvalidOperationException($
"update region error");
73 await
_db.SaveChangesAsync();
RegionService class inserts and updates Region in the Database
async Task< Region > UpdateRegion(Region region)
Updates changes on a Region in the database
RegionService(DataContext db)
async Task< List< Region > > GetAllRegions()
Read all Regions from database
async Task< Region > GetRegionById(int id)
Read one Region with id from database
async Task< Region > AddRegion(Region region)
Adds a Region to the database