Beispiel #1
0
        [HttpDelete("{id}")] // vercnum em FAQ-i id-n u jnjum
        public async Task <string> DeleteFAQ(int id)
        {
            bool done = await FAQActions.DeleteFAQ(id, done : false);

            if (!done)
            {
                return("not exists");
            }
            else
            {
                return("deleted");
            }
        }
Beispiel #2
0
        [HttpGet("{p}")]                                                     // api/Faqs/"search",
        public async Task <ActionResult <Page <FAQ> > > GetFAQsSearch(int p) //string search)
        {
            if (p <= 0)
            {
                return(BadRequest());
            }
            var ToReturn = await FAQActions.GetFAQsSearch(p);

            if (p > ToReturn.PageCount)
            {
                return(BadRequest());
            }
            return(ToReturn);
        }
Beispiel #3
0
        public async Task <ActionResult <List <Group> > > PutFAQ(int id, FAQ fAQ) //
        {
            if (fAQ.Answer == null || fAQ.Question == null || fAQ.GroupId <= 0 || id <= 0)
            {
                return(BadRequest());
            }
            bool done = await FAQActions.PutFAQ(id, fAQ);

            if (!done)
            {
                return(BadRequest());
            }
            else
            {
                return(AG.Groups);
            }
        }
Beispiel #4
0
        public async Task <ActionResult <List <Group> > > PostFAQ(FAQ faq)
        {
            if (faq.Answer == null || faq.Question == null || faq.GroupId <= 0)
            {
                return(BadRequest());
            }

            bool done = await FAQActions.PostFAQ(faq, done : false);

            if (!done)
            {
                return(BadRequest());
            }
            else
            {
                return(AG.Groups);
            }
        }