/// <summary> /// Deletes a weather post entry /// </summary> /// <param name="currentPage"></param> /// <param name="entryId"></param> /// <returns></returns> public ActionResult DeleteWeatherEntry(ExtraNetPage currentPage, string entryId) { Identity id = Identity.Parse(entryId); WeatherDds.RemoveWeather(id); WeatherDds.Weather removed = WeatherDds.GetWeatherEntry(id); if (removed == null) { return(RedirectToAction("Index", new { actionMessage = $"Removed post successfully" })); } return(RedirectToAction("Index", new { actionMessage = $"Could not remove post" })); }
/// <summary> /// Adds a new weather post /// </summary> /// <param name="currentPage"></param> /// <param name="comment"></param> /// <param name="description"></param> /// <returns></returns> public ActionResult AddWeatherEntry(ExtraNetPage currentPage, string comment, string description) { if (comment != null && description != null) { WeatherDds.Weather weather = new WeatherDds.Weather { WeatherDescription = description, WeatherComment = comment, TimeStamp = DateTime.Now, }; WeatherDds.AddWeather(weather); return(RedirectToAction("Index", new { actionMessage = "Post successful!" })); } return(RedirectToAction("Index", new { actionMessage = "Post failed!" })); }