Beispiel #1
0
        // Deletes an address
        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)
            {
                int addressID = int.Parse(RouteData.Values["id"].ToString());

                // Establishes address model
                AddressModel addressModel = new AddressModel();

                // Deletes the address from the database using the ID
                addressModel.DeleteAddress(addressID);

                // TODO: Confirm this is the correct return state
                // Return to address page
                return(Redirect("../address"));
            }
            else
            {
                // If not logged in
                return(Redirect("/login.html"));
            }
        }