public async Task InsertADMasterTimeZone(ADMasterTimeZone objADMasterTimeZone) { try { _Context.ADMasterTimeZones.Add(objADMasterTimeZone); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterTimeZone(ADMasterTimeZone objADMasterTimeZone) { try { _Context.Entry(objADMasterTimeZone).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterTimeZone(long MasterTimeZoneId) { try { ADMasterTimeZone objADMasterTimeZone = _Context.ADMasterTimeZones.Find(MasterTimeZoneId); _Context.ADMasterTimeZones.Remove(objADMasterTimeZone); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterTimeZoneResult> > PutADMasterTimeZone(long id, ADMasterTimeZone objADMasterTimeZone) { if (id != objADMasterTimeZone.MasterTimeZoneId) { return(BadRequest()); } try { await _IMasterTimeZoneInterface.UpdateADMasterTimeZone(objADMasterTimeZone); return(_IMasterTimeZoneInterface.GetADMasterTimeZoneByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterTimeZoneInterface.ADMasterTimeZoneExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterTimeZoneResult> > PostADMasterTimeZone(ADMasterTimeZone objADMasterTimeZone) { try { await _IMasterTimeZoneInterface.InsertADMasterTimeZone(objADMasterTimeZone); return(CreatedAtAction("GetADMasterTimeZone", new { id = objADMasterTimeZone.MasterTimeZoneId }, objADMasterTimeZone)); } catch (Exception ex) { throw new Exception(ex.Message); } }