コード例 #1
0
        public async Task <ThermostatSetting> Add(ThermostatSettingInput thermostatSetting)
        {
            var entity = mapper.MapThermostatSetting(thermostatSetting, new ThermostatSettingEntity());

            this.dbContext.Add(entity);
            await SaveChanges();

            return(mapper.MapThermostatSetting(entity, new ThermostatSetting()));
        }
コード例 #2
0
        public async Task <ThermostatSetting> Update(Guid thermostatSettingId, ThermostatSettingInput thermostatSetting)
        {
            var entity = await this.Entity(thermostatSettingId);

            if (entity != null)
            {
                mapper.MapThermostatSetting(thermostatSetting, entity);
                await SaveChanges();

                return(mapper.MapThermostatSetting(entity, new ThermostatSetting()));
            }
            throw new KeyNotFoundException($"Cannot find thermostatSetting {thermostatSettingId.ToString()}");
        }
コード例 #3
0
 public ThermostatSettingEntity MapThermostatSetting(ThermostatSettingInput src, ThermostatSettingEntity dest)
 {
     return(mapper.Map(src, dest));
 }
コード例 #4
0
 public async Task <ThermostatSetting> Update(Guid thermostatSettingId, [FromBody] ThermostatSettingInput thermostatSetting)
 {
     return(await repo.Update(thermostatSettingId, thermostatSetting));
 }
コード例 #5
0
 public async Task <ThermostatSetting> Add([FromBody] ThermostatSettingInput thermostatSetting)
 {
     return(await repo.Add(thermostatSetting));
 }