public async Task InsertADMasterRegion(ADMasterRegion objADMasterRegion) { try { _Context.ADMasterRegions.Add(objADMasterRegion); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterRegion(ADMasterRegion objADMasterRegion) { try { _Context.Entry(objADMasterRegion).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterRegionResult> > PostADMasterRegion(ADMasterRegion objADMasterRegion) { try { await _IMasterRegionInterface.InsertADMasterRegion(objADMasterRegion); return(CreatedAtAction("GetADMasterRegion", new { id = objADMasterRegion.MasterRegionId }, objADMasterRegion)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterRegion(long MasterRegionId) { try { ADMasterRegion objADMasterRegion = _Context.ADMasterRegions.Find(MasterRegionId); _Context.ADMasterRegions.Remove(objADMasterRegion); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterRegionResult> > PutADMasterRegion(long id, ADMasterRegion objADMasterRegion) { if (id != objADMasterRegion.MasterRegionId) { return(BadRequest()); } try { await _IMasterRegionInterface.UpdateADMasterRegion(objADMasterRegion); return(_IMasterRegionInterface.GetADMasterRegionByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterRegionInterface.ADMasterRegionExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }