public async Task <ActionResult <MasterTaxResult> > PutADMasterTax(long id, ADMasterTax objADMasterTax) { if (id != objADMasterTax.MasterTaxId) { return(BadRequest()); } try { await _IMasterTaxInterface.UpdateADMasterTax(objADMasterTax); return(_IMasterTaxInterface.GetADMasterTaxByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterTaxInterface.ADMasterTaxExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterTaxResult> > PostADMasterTax(ADMasterTax objADMasterTax) { try { await _IMasterTaxInterface.InsertADMasterTax(objADMasterTax); return(CreatedAtAction("GetADMasterTax", new { id = objADMasterTax.MasterTaxId }, objADMasterTax)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task InsertADMasterTax(ADMasterTax objADMasterTax) { try { _Context.ADMasterTaxes.Add(objADMasterTax); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterTax(ADMasterTax objADMasterTax) { try { _Context.Entry(objADMasterTax).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterTax(long MasterTaxId) { try { ADMasterTax objADMasterTax = _Context.ADMasterTaxes.Find(MasterTaxId); _Context.ADMasterTaxes.Remove(objADMasterTax); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }