Esempio n. 1
0
        public async Task <IActionResult> Create(Noticia noticia)
        {
            if (!ModelState.IsValid)
            {
                var autors = await _autorService.FindAllAsync();

                var viewModel = new NoticiaFormViewModel {
                    Noticia = noticia, Autors = autors
                };
                return(View(viewModel));
            }
            await _noticiaService.InsertAsync(noticia);

            return(RedirectToAction(nameof(Index)));
        }