Ejemplo n.º 1
0
        public async Task AddUserDevice(UserDeviceDTO userDeviceDto)
        {
            var userDevice = _mapper.Map <Userdevice>(userDeviceDto);

            userDevice.InputDate = DateTime.Now;
            _context.Userdevices.Add(userDevice);
            await _context.SaveChangesAsync();
        }
        public async Task EditDevice(UserDeviceDTO dto, string deviceName)
        {
            var dev = await _context.Devices.SingleOrDefaultAsync(x => x.DeviceId == dto.DeviceId);

            dev.DeviceName = deviceName;
            var userDevice = _mapper.Map <Userdevice>(dto);

            userDevice.InputDate = DateTime.Now;
            _context.Userdevices.Add(userDevice);
            await _context.SaveChangesAsync();
        }