public async Task InsertADMasterEmployeeType(ADMasterEmployeeType objADMasterEmployeeType) { try { _Context.ADMasterEmployeeTypes.Add(objADMasterEmployeeType); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterEmployeeType(ADMasterEmployeeType objADMasterEmployeeType) { try { _Context.Entry(objADMasterEmployeeType).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterEmployeeType(long MasterEmployeeTypeId) { try { ADMasterEmployeeType objADMasterEmployeeType = _Context.ADMasterEmployeeTypes.Find(MasterEmployeeTypeId); _Context.ADMasterEmployeeTypes.Remove(objADMasterEmployeeType); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterEmployeeTypeResult> > PutADMasterEmployeeType(long id, ADMasterEmployeeType objADMasterEmployeeType) { if (id != objADMasterEmployeeType.MasterEmployeeTypeId) { return(BadRequest()); } try { await _IMasterEmployeeTypeInterface.UpdateADMasterEmployeeType(objADMasterEmployeeType); return(_IMasterEmployeeTypeInterface.GetADMasterEmployeeTypeByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterEmployeeTypeInterface.ADMasterEmployeeTypeExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterEmployeeTypeResult> > PostADMasterEmployeeType(ADMasterEmployeeType objADMasterEmployeeType) { try { await _IMasterEmployeeTypeInterface.InsertADMasterEmployeeType(objADMasterEmployeeType); return(CreatedAtAction("GetADMasterEmployeeType", new { id = objADMasterEmployeeType.MasterEmployeeTypeId }, objADMasterEmployeeType)); } catch (Exception ex) { throw new Exception(ex.Message); } }