// Deletes a message public ActionResult Delete() { // Null handling if (Session["loggedInState"] == null) { return Redirect("/403.html"); } // Checks if logged in bool state = (bool)Session["loggedInState"]; if (state == true) { // Acquires the ID of the message int messageID = int.Parse(RouteData.Values["id"].ToString()); // Establishes message model MessageModel messageModel = new MessageModel(); // Deletes the message messageModel.DeleteMessage(messageID); // Return to the message page return Redirect("/..message"); } else { // If not logged in return Redirect("/login.html"); } }