public async Task UpdateADMasterCompany(ADMasterCompany objADMasterCompany) { try { _Context.Entry(objADMasterCompany).State = EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task InsertADMasterCompany(ADMasterCompany objADMasterCompany) { try { _Context.ADMasterCompanies.Add(objADMasterCompany); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterCompanyResult> > PostADMasterCompany(ADMasterCompany objADMasterCompany) { try { await _IMasterCompanyInterface.InsertADMasterCompany(objADMasterCompany); return(CreatedAtAction("GetADMasterCompany", new { id = objADMasterCompany.MasterCompanyId }, objADMasterCompany)); } catch (Exception ex) { _logger.LogError(ex.Message); throw new Exception(ex.Message); } }
public async Task <ActionResult <ADMasterCompany> > PostMasterCompany(ADMasterCompany objADMasterCompany) { try { if (!MasterCompanyExists(objADMasterCompany.CompanyTitle)) { _context.ADMasterCompanies.Add(objADMasterCompany); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMasterCompany", new { MasterCompanyId = objADMasterCompany.MasterCompanyId }, objADMasterCompany)); } else { return(UnprocessableEntity()); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterCompanyResult> > PutADMasterCompany(long id, ADMasterCompany objADMasterCompany) { if (id != objADMasterCompany.MasterCompanyId) { return(BadRequest()); } try { await _IMasterCompanyInterface.UpdateADMasterCompany(objADMasterCompany); return(_IMasterCompanyInterface.GetADMasterCompanyByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterCompanyInterface.ADMasterCompanyExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { _logger.LogError(ex.Message); throw new Exception(ex.Message); } return(NoContent()); }