Exemple #1
0
 public override async Task <BaseReply> Incluir(TarefaModel request, ServerCallContext context)
 {
     return(await Task.FromResult(new BaseReply
     {
         Id = _tarefaAppService.Incluir(_mapper.Map <TarefaViewModel>(request)).ToString()
     }));
 }
Exemple #2
0
        public ActionResult <TarefaViewModel> Post([FromBody] TarefaViewModel obj)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            return(CreatedAtAction(nameof(Get), new { id = obj.Id }, obj));
        }
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                SelectProjetos    = new SelectList(_projetoAppService.Listar(), "Id", "Nome");
                SelectSistemas    = new SelectList(_sistemaAppService.Listar(), "Id", "Descricao");
                SelectWorkflows   = new SelectList(_workflowAppService.Listar(), "Id", "Nome");
                SelectTipoTarefas = new SelectList(_tipoTarefaAppService.Listar(), "Id", "Nome");

                return(Page());
            }

            _tarefaAppService.Incluir(Tarefa);

            return(RedirectToPage("Listar"));
        }