public async Task InsertADMasterReportingHead(ADMasterReportingHead objADMasterReportingHead) { try { _Context.ADMasterReportingHeads.Add(objADMasterReportingHead); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterReportingHead(ADMasterReportingHead objADMasterReportingHead) { try { _Context.Entry(objADMasterReportingHead).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterReportingHead(long MasterReportingHeadId) { try { ADMasterReportingHead objADMasterReportingHead = _Context.ADMasterReportingHeads.Find(MasterReportingHeadId); _Context.ADMasterReportingHeads.Remove(objADMasterReportingHead); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterReportingHeadResult> > PutADMasterReportingHead(long id, ADMasterReportingHead objADMasterReportingHead) { if (id != objADMasterReportingHead.MasterReportingHeadId) { return(BadRequest()); } try { await _IMasterReportingHeadInterface.UpdateADMasterReportingHead(objADMasterReportingHead); return(_IMasterReportingHeadInterface.GetADMasterReportingHeadByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterReportingHeadInterface.ADMasterReportingHeadExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterReportingHeadResult> > PostADMasterReportingHead(ADMasterReportingHead objADMasterReportingHead) { try { await _IMasterReportingHeadInterface.InsertADMasterReportingHead(objADMasterReportingHead); return(CreatedAtAction("GetADMasterReportingHead", new { id = objADMasterReportingHead.MasterReportingHeadId }, objADMasterReportingHead)); } catch (Exception ex) { throw new Exception(ex.Message); } }