public async Task InsertADMasterRegistration(ADMasterRegistration objADMasterRegistration) { try { _Context.ADMasterRegistration.Add(objADMasterRegistration); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterRegistration(ADMasterRegistration objADMasterRegistration) { try { _Context.Entry(objADMasterRegistration).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterRegistration(long MasterRegistrationId) { try { ADMasterRegistration objADMasterRegistration = _Context.ADMasterRegistration.Find(MasterRegistrationId); _Context.ADMasterRegistration.Remove(objADMasterRegistration); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterRegistrationResult> > PutADMasterRegistration(long id, ADMasterRegistration objADMasterRegistration) { if (id != objADMasterRegistration.MasterRegistrationId) { return(BadRequest()); } try { await _IMasterRegistrationInterface.UpdateADMasterRegistration(objADMasterRegistration); return(_IMasterRegistrationInterface.GetADMasterRegistrationByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterRegistrationInterface.ADMasterRegistrationExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterRegistrationResult> > PostADMasterRegistration(ADMasterRegistration objADMasterRegistration) { try { await _IMasterRegistrationInterface.InsertADMasterRegistration(objADMasterRegistration); return(CreatedAtAction("GetADMasterRegistration", new { id = objADMasterRegistration.MasterRegistrationId }, objADMasterRegistration)); } catch (Exception ex) { throw new Exception(ex.Message); } }