public async Task InsertADMasterPaymentType(ADMasterPaymentType objADMasterPaymentType) { try { _Context.ADMasterPaymentTypes.Add(objADMasterPaymentType); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterPaymentType(ADMasterPaymentType objADMasterPaymentType) { try { _Context.Entry(objADMasterPaymentType).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterPaymentType(long MasterPaymentTypeId) { try { ADMasterPaymentType objADMasterPaymentType = _Context.ADMasterPaymentTypes.Find(MasterPaymentTypeId); _Context.ADMasterPaymentTypes.Remove(objADMasterPaymentType); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterPaymentTypeResult> > PostADMasterPaymentType(ADMasterPaymentType objADMasterPaymentType) { try { await _IMasterPaymentTypeInterface.InsertADMasterPaymentType(objADMasterPaymentType); return(CreatedAtAction("GetADMasterPaymentType", new { id = objADMasterPaymentType.MasterPaymentTypeId }, objADMasterPaymentType)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterPaymentTypeResult> > PutADMasterPaymentType(long id, ADMasterPaymentType objADMasterPaymentType) { if (id != objADMasterPaymentType.MasterPaymentTypeId) { return(BadRequest()); } try { await _IMasterPaymentTypeInterface.UpdateADMasterPaymentType(objADMasterPaymentType); return(_IMasterPaymentTypeInterface.GetADMasterPaymentTypeByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterPaymentTypeInterface.ADMasterPaymentTypeExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }