Exemplo n.º 1
0
        public async Task InsertADMasterRegisteredDevice(ADMasterRegisteredDevice objADMasterRegisteredDevice)
        {
            try
            {
                _Context.ADMasterRegisteredDevices.Add(objADMasterRegisteredDevice);

                await _Context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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());
        }
Exemplo n.º 5
0
        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);
            }
        }