public async Task <IActionResult> Put(int id, [FromBody] WeatherConditionType entity) { try { return(Ok(await agent.Update(id, entity))); } catch (Exception ex) { return(await HandleExceptionAsync(ex)); } }
public async Task <IActionResult> Post([FromBody] WeatherConditionType entity) { try { if (!isValid(entity)) { return(new BadRequestResult()); // This returns HTTP 404 } return(Ok(await agent.Add(entity))); } catch (Exception ex) { return(await HandleExceptionAsync(ex)); } }
public WeatherCondition GetWeatherCondition(WeatherConditionType type) { throw new NotImplementedException(); }
public Task <WeatherConditionType> Update(Int32 pkId, WeatherConditionType item) { return(this.Update <WeatherConditionType>(pkId, item)); }
public Task <WeatherConditionType> Add(WeatherConditionType item) { return(this.Add <WeatherConditionType>(item)); }
public WeatherCondition GetWeatherCondition(WeatherConditionType type) { try { switch (type) { case WeatherConditionType.Thunderstrom: { return(new WeatherCondition { BackgroundColor = Color.DarkGray, TextColor = Color.White, Type = WeatherConditionType.Thunderstrom }); } case WeatherConditionType.Drizzle: { return(new WeatherCondition { BackgroundColor = Color.LightGray, TextColor = Color.White, Type = WeatherConditionType.Drizzle }); } case WeatherConditionType.Rain: { return(new WeatherCondition { BackgroundColor = Color.PowderBlue, TextColor = Color.Black, Type = WeatherConditionType.Rain }); } case WeatherConditionType.Snow: { return(new WeatherCondition { BackgroundColor = Color.White, TextColor = Color.DarkGray, Type = WeatherConditionType.Snow }); } case WeatherConditionType.Mist: { return(new WeatherCondition { BackgroundColor = Color.GhostWhite, TextColor = Color.DarkGray, Type = WeatherConditionType.Snow }); } case WeatherConditionType.Smoke: { return(new WeatherCondition { BackgroundColor = Color.SlateGray, TextColor = Color.Gray, Type = WeatherConditionType.Smoke }); } case WeatherConditionType.Haze: { return(new WeatherCondition { BackgroundColor = Color.OrangeRed, TextColor = Color.Navy, Type = WeatherConditionType.Haze }); } case WeatherConditionType.Sand: { return(new WeatherCondition { BackgroundColor = Color.SandyBrown, TextColor = Color.Navy, Type = WeatherConditionType.Sand }); } case WeatherConditionType.Dust_Whrils: { return(new WeatherCondition { BackgroundColor = Color.RosyBrown, TextColor = Color.Black, Type = WeatherConditionType.Dust_Whrils }); } case WeatherConditionType.Fog: { return(new WeatherCondition { BackgroundColor = Color.LightSlateGray, TextColor = Color.Navy, Type = WeatherConditionType.Fog }); } case WeatherConditionType.Dust: { return(new WeatherCondition { BackgroundColor = Color.RosyBrown, TextColor = Color.Black, Type = WeatherConditionType.Dust_Whrils }); } case WeatherConditionType.Volcanic_Ash: { return(new WeatherCondition { BackgroundColor = Color.OrangeRed, TextColor = Color.DarkGray, Type = WeatherConditionType.Volcanic_Ash }); } case WeatherConditionType.Squalls: { return(new WeatherCondition { BackgroundColor = Color.LightBlue, TextColor = Color.Navy, Type = WeatherConditionType.Squalls }); } case WeatherConditionType.Tornado: { return(new WeatherCondition { BackgroundColor = Color.PaleVioletRed, TextColor = Color.Navy, Type = WeatherConditionType.Tornado }); } case WeatherConditionType.Clear: { return(new WeatherCondition { BackgroundColor = Color.SkyBlue, TextColor = Color.Navy, Type = WeatherConditionType.Clear }); } case WeatherConditionType.Clouds: { return(new WeatherCondition { BackgroundColor = Color.WhiteSmoke, TextColor = Color.SlateGray, Type = WeatherConditionType.Clouds }); } default: { return(new WeatherCondition { BackgroundColor = Color.SkyBlue, TextColor = Color.Navy, Type = WeatherConditionType.Clear }); } } } catch (Exception ex) { throw new Exception(ex.Message); } }