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())); }
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()}"); }
public ThermostatSettingEntity MapThermostatSetting(ThermostatSettingInput src, ThermostatSettingEntity dest) { return(mapper.Map(src, dest)); }
public async Task <ThermostatSetting> Update(Guid thermostatSettingId, [FromBody] ThermostatSettingInput thermostatSetting) { return(await repo.Update(thermostatSettingId, thermostatSetting)); }
public async Task <ThermostatSetting> Add([FromBody] ThermostatSettingInput thermostatSetting) { return(await repo.Add(thermostatSetting)); }