public async Task InsertADGenCodeMaster(ADGenCodeMaster objADGenCodeMaster) { try { _Context.ADGenCodeMasters.Add(objADGenCodeMaster); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADGenCodeMaster(ADGenCodeMaster objADGenCodeMaster) { try { _Context.Entry(objADGenCodeMaster).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <GenCodeMasterResult> > PostADGenCodeMasters(ADGenCodeMaster objADGenCodeMasters) { try { await _IGenCodeMastersInterface.InsertADGenCodeMaster(objADGenCodeMasters); return(CreatedAtAction("GetADGenCodeMasters", new { id = objADGenCodeMasters.GenCodeMasterId }, objADGenCodeMasters)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADGenCodeMaster(long GenCodeMasterId) { try { ADGenCodeMaster objADGenCodeMaster = _Context.ADGenCodeMasters.Find(GenCodeMasterId); _Context.ADGenCodeMasters.Remove(objADGenCodeMaster); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <GenCodeMasterResult> > PutADGenCodeMasters(long id, ADGenCodeMaster objADGenCodeMasters) { if (id != objADGenCodeMasters.GenCodeMasterId) { return(BadRequest()); } try { await _IGenCodeMastersInterface.UpdateADGenCodeMaster(objADGenCodeMasters); return(_IGenCodeMastersInterface.GetADGenCodeMasterByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IGenCodeMastersInterface.ADGenCodeMasterExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }