示例#1
0
        public IActionResult Post([FromBody] BookViewModel bookViewModel)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(Response(bookViewModel));
            }

            _bookAppService.Register(bookViewModel);

            return(Response(bookViewModel));
        }
示例#2
0
        public IActionResult Create(BookViewModel bookViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(bookViewModel));
            }
            _bookAppService.Register(bookViewModel);

            if (IsValidOperation())
            {
                ViewBag.Sucesso = "Book Registered!";
            }

            return(View(bookViewModel));
        }