Beispiel #1
0
        public void ImportModule(Module module, string content, string version)
        {
            List <FAQ> FAQs = null;

            if (!string.IsNullOrEmpty(content))
            {
                FAQs = JsonSerializer.Deserialize <List <FAQ> >(content);
            }

            if (FAQs == null)
            {
                return;
            }

            foreach (var FAQ in FAQs)
            {
                var _FAQ = new FAQ
                {
                    ModuleId = module.ModuleId,
                    Question = FAQ.Question,
                    Answer   = FAQ.Answer,
                    Order    = FAQ.Order
                };
                _FAQs.AddFAQ(_FAQ);
            }
        }
        public FAQ Post([FromBody] FAQ FAQ)
        {
            if (!ModelState.IsValid)
            {
                HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(FAQ);
            }

            FAQ = _FAQs.AddFAQ(FAQ);
            _logger.Log(LogLevel.Information, this, LogFunction.Create, $"FAQ Added {FAQ}");
            return(FAQ);
        }