public async Task InsertADMasterMailTemplate(ADMasterMailTemplate objADMasterMailTemplate) { try { _Context.ADMasterMailTemplates.Add(objADMasterMailTemplate); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterMailTemplate(ADMasterMailTemplate objADMasterMailTemplate) { try { _Context.Entry(objADMasterMailTemplate).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterMailTemplate(long MasterMailTemplateId) { try { ADMasterMailTemplate objADMasterMailTemplate = _Context.ADMasterMailTemplates.Find(MasterMailTemplateId); _Context.ADMasterMailTemplates.Remove(objADMasterMailTemplate); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterMailTemplateResult> > PutADMasterMailTemplate(long id, ADMasterMailTemplate objADMasterMailTemplate) { if (id != objADMasterMailTemplate.MasterMailTemplateId) { return(BadRequest()); } try { await _IMasterMailTemplateInterface.UpdateADMasterMailTemplate(objADMasterMailTemplate); return(_IMasterMailTemplateInterface.GetADMasterMailTemplateByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterMailTemplateInterface.ADMasterMailTemplateExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterMailTemplateResult> > PostADMasterMailTemplate(ADMasterMailTemplate objADMasterMailTemplate) { try { await _IMasterMailTemplateInterface.InsertADMasterMailTemplate(objADMasterMailTemplate); return(CreatedAtAction("GetADMasterMailTemplate", new { id = objADMasterMailTemplate.MasterMailTemplateId }, objADMasterMailTemplate)); } catch (Exception ex) { throw new Exception(ex.Message); } }