public async Task InsertADMasterMessageType(ADMasterMessageType objADMasterMessageType) { try { _Context.ADMasterMessageTypes.Add(objADMasterMessageType); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterMessageType(ADMasterMessageType objADMasterMessageType) { try { _Context.Entry(objADMasterMessageType).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterMessageType(long MasterMessageTypeId) { try { ADMasterMessageType objADMasterMessageType = _Context.ADMasterMessageTypes.Find(MasterMessageTypeId); _Context.ADMasterMessageTypes.Remove(objADMasterMessageType); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterMessageTypeResult> > PutADMasterMessageType(long id, ADMasterMessageType objADMasterMessageType) { if (id != objADMasterMessageType.MasterMessageTypeId) { return(BadRequest()); } try { await _IMasterMessageTypeInterface.UpdateADMasterMessageType(objADMasterMessageType); return(_IMasterMessageTypeInterface.GetADMasterMessageTypeByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterMessageTypeInterface.ADMasterMessageTypeExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterMessageTypeResult> > PostADMasterMessageType(ADMasterMessageType objADMasterMessageType) { try { await _IMasterMessageTypeInterface.InsertADMasterMessageType(objADMasterMessageType); return(CreatedAtAction("GetADMasterMessageType", new { id = objADMasterMessageType.MasterMessageTypeId }, objADMasterMessageType)); } catch (Exception ex) { throw new Exception(ex.Message); } }