public async Task UpdateADMasterCompanyType(ADMasterCompanyType objADMasterCompanyType) { try { _Context.Entry(objADMasterCompanyType).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task InsertADMasterCompanyType(ADMasterCompanyType objADMasterCompanyType) { try { _Context.ADMasterCompanyTypes.Add(objADMasterCompanyType); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterCompanyType(long MasterCompanyTypeId) { try { ADMasterCompanyType objADMasterCompanyType = _Context.ADMasterCompanyTypes.Find(MasterCompanyTypeId); _Context.ADMasterCompanyTypes.Remove(objADMasterCompanyType); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterCompanyTypeResult> > PutADMasterCompanyType(long id, ADMasterCompanyType objADMasterCompanyType) { if (id != objADMasterCompanyType.MasterCompanyTypeId) { return(BadRequest()); } try { await _IMasterCompanyTypeInterface.UpdateADMasterCompanyType(objADMasterCompanyType); return(_IMasterCompanyTypeInterface.GetADMasterCompanyTypeByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterCompanyTypeInterface.ADMasterCompanyTypeExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterCompanyTypeResult> > PostADMasterCompanyType(ADMasterCompanyType objADMasterCompanyType) { try { await _IMasterCompanyTypeInterface.InsertADMasterCompanyType(objADMasterCompanyType); return(CreatedAtAction("GetADMasterCompanyType", new { id = objADMasterCompanyType.MasterCompanyTypeId }, objADMasterCompanyType)); } catch (Exception ex) { throw new Exception(ex.Message); } }