Esempio n. 1
0
        public async Task <IActionResult> Create(SectionCreateFormModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            if (model.Description == null || model.Title == null)
            {
                return(BadRequest());
            }

            var success = await sections.Create(model.Title, model.Description);

            if (!success)
            {
                return(BadRequest());
            }

            TempData.AddSuccessMessage($"Article {model.Title} successfully published.");

            return(Redirect("/Forum/Home/Index"));
        }