public async Task InsertADMasterRegisteredDevice(ADMasterRegisteredDevice objADMasterRegisteredDevice) { try { _Context.ADMasterRegisteredDevices.Add(objADMasterRegisteredDevice); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterRegisteredDevice(ADMasterRegisteredDevice objADMasterRegisteredDevice) { try { _Context.Entry(objADMasterRegisteredDevice).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterRegisteredDevice(long MasterRegisteredDeviceId) { try { ADMasterRegisteredDevice objADMasterRegisteredDevice = _Context.ADMasterRegisteredDevices.Find(MasterRegisteredDeviceId); _Context.ADMasterRegisteredDevices.Remove(objADMasterRegisteredDevice); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterRegisteredDeviceResult> > PutADMasterRegisteredDevice(long id, ADMasterRegisteredDevice objADMasterRegisteredDevice) { if (id != objADMasterRegisteredDevice.MasterRegisteredDeviceId) { return(BadRequest()); } try { await _IMasterRegisteredDeviceInterface.UpdateADMasterRegisteredDevice(objADMasterRegisteredDevice); return(_IMasterRegisteredDeviceInterface.GetADMasterRegisteredDeviceByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterRegisteredDeviceInterface.ADMasterRegisteredDeviceExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterRegisteredDeviceResult> > PostADMasterRegisteredDevice(ADMasterRegisteredDevice objADMasterRegisteredDevice) { try { await _IMasterRegisteredDeviceInterface.InsertADMasterRegisteredDevice(objADMasterRegisteredDevice); return(CreatedAtAction("GetADMasterRegisteredDevice", new { id = objADMasterRegisteredDevice.MasterRegisteredDeviceId }, objADMasterRegisteredDevice)); } catch (Exception ex) { throw new Exception(ex.Message); } }