public IActionResult Delete(int id) { if (null != _temperatureRepository.GetTemperatureById(id)) { _temperatureRepository.DeleteTemperature(id); _temperatureRepository.Save(); return(Ok()); } return(NotFound()); }
public IActionResult RemoveTemperature(Guid userId, Guid temperatureId) { var user = _usersRepository.GetUserById(userId); if (user == null) { return(NotFound("User provided was not found")); } var persistedTemperature = _temperatureRepository.GetTemperatureById(temperatureId, userId); if (persistedTemperature == null) { return(NotFound("The provided temperature does not exist")); } _temperatureRepository.DeleteTemperature(persistedTemperature); _temperatureRepository.Save(); return(NoContent()); }