示例#1
0
 public async Task Save(RegionModel regionModel)
 {
     if (ModelState.IsValid)
     {
         var newRegion = new Region()
         {
             Name           = regionModel.Name,
             ParentRegionID = regionModel.ParentRegionID
         };
         _dBContext.Regions.Add(newRegion);
         await _dBContext.SaveChangesAsync();
     }
 }
 public async Task Save(EmployeeModel employeeModel)
 {
     if (ModelState.IsValid)
     {
         var newEmployee = new Employee()
         {
             Name     = employeeModel.Name,
             Surname  = employeeModel.Surname,
             RegionID = employeeModel.RegionID
         };
         _dBContext.Employees.Add(newEmployee);
         await _dBContext.SaveChangesAsync();
     }
 }