public async Task InsertADMasterAddressType(ADMasterAddressType objADMasterAddressType) { try { _Context.ADMasterAddressTypes.Add(objADMasterAddressType); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterAddressType(ADMasterAddressType objADMasterAddressType) { try { _Context.Entry(objADMasterAddressType).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterAddressType(long MasterAddressTypeId) { try { ADMasterAddressType objADMasterAddressType = _Context.ADMasterAddressTypes.Find(MasterAddressTypeId); _Context.ADMasterAddressTypes.Remove(objADMasterAddressType); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterAddressTypeResult> > PutADMasterAddressType(long id, ADMasterAddressType objADMasterAddressType) { if (id != objADMasterAddressType.MasterAddressTypeId) { return(BadRequest()); } try { await _IMasterAddressTypeInterface.UpdateADMasterAddressType(objADMasterAddressType); return(_IMasterAddressTypeInterface.GetADMasterAddressTypeByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterAddressTypeInterface.ADMasterAddressTypeExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterAddressTypeResult> > PostADMasterAddressType(ADMasterAddressType objADMasterAddressType) { try { await _IMasterAddressTypeInterface.InsertADMasterAddressType(objADMasterAddressType); return(CreatedAtAction("GetADMasterAddressType", new { id = objADMasterAddressType.MasterAddressTypeId }, objADMasterAddressType)); } catch (Exception ex) { throw new Exception(ex.Message); } }