예제 #1
0
        public ActionResult <ProjetoViewModel> Post([FromBody] ProjetoViewModel obj)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                _projetoAppService.Incluir(obj);
            }
            catch (DbUpdateException)
            {
                if (ObjExists(obj.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction(nameof(Get), new { id = obj.Id }, obj));
        }
예제 #2
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                SelectSistemas = new SelectList(_sistemaAppService.Listar(), "Id", "Nome");

                return(Page());
            }

            _projetoAppService.Incluir(Projeto);

            return(RedirectToPage("Listar"));
        }