示例#1
0
        public async Task <ActionResult <Faq> > Create([FromForm] FaqViewModel faqViewModel)
        {
            if (faqViewModel == null)
            {
                return(NoContent());
            }
            if (ModelState.IsValid)
            {
                // var faq = FaqViewModel.MapFaqViewModelToEntity(faqViewModel);
                var faq           = _createFaqFromViewwModel.CreateMapping(faqViewModel);
                var createdResult = await _faqService.CreateAsync(faq);

                if (createdResult.Item2)
                {
                    return(Ok("Successfully created Faq!"));
                }
                return(BadRequest("Something went wrong when create Faq."));
            }
            return(BadRequest(ModelState));
        }