using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CarGallery
{
    public partial class AdminDeleteComment : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] == null || Session["username"].ToString() == "")
                Response.Redirect("Login.aspx");

            if(Session["comment_id"] == null || Session["comment_id"].ToString() == "")
                Response.Redirect("AdminManageComments.aspx");

            
            lblQuestion.Text = "Are you sure you want to Delete Comment : " + Session["comment_id"].ToString() + " ?";
        }

        protected void btnNo_Click(object sender, EventArgs e)
        {
            Session["comment_id"] = null;
            Response.Redirect("AdminManageComments.aspx");
        }

        protected void btnYes_Click(object sender, EventArgs e)
        {
            DatabaseRepository repo = new DatabaseRepository();

            repo.commentDelete(Session["comment_id"].ToString());

            Response.Redirect("AdminManageComments.aspx");
        }
    }
}