void UpdateDevice(ref Device dev, DeviceExtendedModel model)
 {
     dev.comment = model.comment;
     dev.id_fixed_asset = model.id_fixed_asset;
     dev.ip_address = model.ip_address;
     dev.mac_address = model.mac_address;
     dev.model = model.modell;
     dev.producer = model.producer;
     dev.serial_number = model.serial_number;
 }
        Device CreateDeviceFromDeviceModel(DeviceExtendedModel device)
        {
            Device model = new Device();
            model.comment = device.comment;
            model.id = device.id;
            model.id_fixed_asset = device.id_fixed_asset;
            model.ip_address = device.ip_address;
            model.mac_address = device.mac_address;
            int id_peripheral;
            int.TryParse(device.peripheral_device_name, out id_peripheral);
            model.id_peripheral_device = id_peripheral;
            model.producer = device.producer;
            model.serial_number = device.serial_number;

            return model;
        }
        DeviceExtendedModel CreateDeviceModelFromDevice(Device device)
        {
            DeviceExtendedModel model = new DeviceExtendedModel();
            model.comment = device.comment;
            model.id = device.id;
            model.id_fixed_asset = device.id_fixed_asset;
            model.ip_address = device.ip_address;
            model.mac_address = device.mac_address;
            model.modell = device.model;
            model.peripheral_device_id = device.id_peripheral_device;
            model.peripheral_device_name = device.PeripheralDevice.name;
            model.producer = device.producer;
            model.serial_number = device.serial_number;

            return model;
        }
 public ActionResult Delete(DeleteObjectById model)
 {
     Device device = new Device() { id = model.Id };
     deviceRepository.DeleteObject(device);
     return RedirectToAction("Index");
 }