Example #1
0
        public override bool Init(Client client)
        {
            int faqID;

            if (int.TryParse(BaseFuncs.GetAdditionalURLArray(client.URL, this.URL)[0], out faqID))
            {
                RussianKawaiShop.FAQ faq = faqService.GetByID(faqID);
                if (faq != null)
                {
                    Hashtable data = new Hashtable();

                    if (client.PostParam("EditFAQ") != null)
                    {
                        if (client.PostParam("question") != null && client.PostParam("answer") != null)
                        {
                            faq.Question = client.PostParam("question");
                            faq.Answer   = client.PostParam("answer");
                            faqService.Edit(faq);

                            client.Redirect("/faq/#pr_" + faq.ID);
                            Logger.ConsoleLog("Edited faq: " + faq.Question + " (ID: " + faq.ID + ")", ConsoleColor.Yellow);

                            return(false);
                        }
                    }
                    data.Add("FAQ", faq);
                    client.HttpSend(TemplateActivator.Activate(this, client, data));
                    return(true);
                }
            }


            BaseFuncs.Show404(client);
            return(false);
        }
Example #2
0
        public override bool Init(Client client)
        {
            if (client.PostParam("AddFAQ") != null)
            {
                if (client.PostParam("question") != null && client.PostParam("answer") != null)
                {
                    RussianKawaiShop.FAQ fq = new RussianKawaiShop.FAQ();
                    fq.Question = client.PostParam("question");
                    fq.Answer   = client.PostParam("answer");

                    RussianKawaiShop.FAQ faq = faqService.Create(fq);
                    if (faq != null)
                    {
                        client.Redirect("/faq/#pr_" + faq.ID);
                        Logger.ConsoleLog("Added new faq: " + faq.Question + " (ID: " + faq.ID + ")", ConsoleColor.Yellow);

                        return(false);
                    }
                }
            }

            client.HttpSend(TemplateActivator.Activate(this, client));
            return(true);
        }