public async Task UpdateADMasterColor(ADMasterColor objADMasterColor) { try { _Context.Entry(objADMasterColor).State = EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task InsertADMasterColor(ADMasterColor objADMasterColor) { try { _Context.ADMasterColors.Add(objADMasterColor); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterColorResult> > PostADMasterColor(ADMasterColor objADMasterColor) { try { await _IMasterColorInterface.InsertADMasterColor(objADMasterColor); return(CreatedAtAction("GetADMasterColor", new { id = objADMasterColor.MasterColorId }, objADMasterColor)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterColorResult> > PutADMasterColor(long id, ADMasterColor objADMasterColor) { if (id != objADMasterColor.MasterColorId) { return(BadRequest()); } try { await _IMasterColorInterface.UpdateADMasterColor(objADMasterColor); return(_IMasterColorInterface.GetADMasterColorByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterColorInterface.ADMasterColorExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }