public async Task InsertADMasterState(ADMasterState objADMasterState) { try { _Context.ADMasterStates.Add(objADMasterState); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterState(ADMasterState objADMasterState) { try { _Context.Entry(objADMasterState).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterStateResult> > PostADMasterState(ADMasterState objADMasterState) { try { await _IMasterStateInterface.InsertADMasterState(objADMasterState); return(CreatedAtAction("GetADMasterState", new { id = objADMasterState.MasterStateId }, objADMasterState)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterState(long MasterStateId) { try { ADMasterState objADMasterState = _Context.ADMasterStates.Find(MasterStateId); _Context.ADMasterStates.Remove(objADMasterState); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterStateResult> > PutADMasterState(long id, ADMasterState objADMasterState) { if (id != objADMasterState.MasterStateId) { return(BadRequest()); } try { await _IMasterStateInterface.UpdateADMasterState(objADMasterState); return(_IMasterStateInterface.GetADMasterStateByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterStateInterface.ADMasterStateExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }