public async Task UpdateADMasterBranch(ADMasterBranch objADMasterBranch) { try { _Context.Entry(objADMasterBranch).State = EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task InsertADMasterBranch(ADMasterBranch objADMasterBranch) { try { _Context.ADMasterBranches.Add(objADMasterBranch); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterBranchResult> > PostADMasterBranch(ADMasterBranch objADMasterBranch) { try { await _IMasterBranchInterface.InsertADMasterBranch(objADMasterBranch); return(CreatedAtAction("GetADMasterBranch", new { id = objADMasterBranch.MasterBranchId }, objADMasterBranch)); } catch (Exception ex) { _logger.LogError(ex.Message); throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterBranchResult> > PutADMasterBranch(long id, ADMasterBranch objADMasterBranch) { if (id != objADMasterBranch.MasterBranchId) { return(BadRequest()); } try { await _IMasterBranchInterface.UpdateADMasterBranch(objADMasterBranch); return(_IMasterBranchInterface.GetADMasterBranchByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterBranchInterface.ADMasterBranchExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { _logger.LogError(ex.Message); throw new Exception(ex.Message); } return(NoContent()); }