using System;
using System.Web.Script.Serialization;

namespace ynhtm.API
{
    using Common;
    using DBUtility;
    using Theme;
    using WebControls;

    public class Comment : BaseHandler
    {
        public override void Process()
        {
            switch (this.Request["Action"])
            {
                case "Post":
                    this.Post();
                    break;
            }
        }

        void Post()
        {
            var request = this.Request;
            var response = this.Response;
            var comment = new BLL.Comment();
            var result = comment.Post(request, response, this.Session, this.User);
            if (request["Ajax"] == "1")
            {
                this.WriteJSON(result);
            }
            else
                response.Redirect(request["Url"] ?? request.UrlReferrer.ToString());
        }
    }
}