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

            try
            {
                obj.Id = _impedimentoTarefaAppService.Incluir(obj);
            }
            catch (Exception)
            {
                if (ObjExists(obj.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetImpedimentoTarefa", new { id = obj.Id }, obj));
        }
Beispiel #3
0
        public IActionResult OnPost(Guid idTarefa)
        {
            if (!ModelState.IsValid)
            {
                Tarefa = _tarefaAppService.Consultar(idTarefa);

                SelectImpedimentos = new SelectList(_impedimentoAppService.Listar(), "Id", "Nome");

                return(Page());
            }

            _impedimentoTarefaAppService.Incluir(ImpedimentoTarefa);

            return(RedirectToPage("Listar", new { idTarefa }));
        }