public async Task <ActionResult <MasterStatusResult> > PostADMasterStatus(ADMasterStatus objADMasterStatus) { try { await _IMasterStatusInterface.InsertADMasterStatus(objADMasterStatus); return(CreatedAtAction("GetADMasterStatus", new { id = objADMasterStatus.MasterStatusId }, objADMasterStatus)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task InsertADMasterStatus(ADMasterStatus objADMasterStatus) { try { _Context.ADMasterStatuss.Add(objADMasterStatus); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterStatus(ADMasterStatus objADMasterStatus) { try { _Context.Entry(objADMasterStatus).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterStatus(long MasterStatusId) { try { ADMasterStatus objADMasterStatus = _Context.ADMasterStatuss.Find(MasterStatusId); _Context.ADMasterStatuss.Remove(objADMasterStatus); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterStatusResult> > PutADMasterStatus(long id, ADMasterStatus objADMasterStatus) { if (id != objADMasterStatus.MasterStatusId) { return(BadRequest()); } try { await _IMasterStatusInterface.UpdateADMasterStatus(objADMasterStatus); return(_IMasterStatusInterface.GetADMasterStatusByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterStatusInterface.ADMasterStatusExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }