Пример #1
0
        public ActionResult <RecursoTarefaViewModel> Post([FromBody] RecursoTarefaViewModel obj)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            return(CreatedAtAction(nameof(Get), new { id = obj.Id }, obj));
        }
Пример #2
0
 public override async Task <BaseReply> Incluir(RecursoTarefaModel request, ServerCallContext context)
 {
     return(await Task.FromResult(new BaseReply
     {
         Id = _recursoTarefaAppService.Incluir(_mapper.Map <RecursoTarefaViewModel>(request)).ToString()
     }));
 }
Пример #3
0
        public IActionResult OnPost(Guid idTarefa)
        {
            if (!ModelState.IsValid)
            {
                Tarefa         = _tarefaAppService.Consultar(idTarefa);
                SelectRecursos = new SelectList(_recursoProjetoAppService.ListarPorProjeto(Tarefa.IdProjeto), "Recurso.Id", "Recurso.Nome");

                return(Page());
            }

            _recursoTarefaAppService.Incluir(RecursoTarefa);

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