Esempio n. 1
0
        public async Task CreateTarefa([FromBody] CadastroTarefaModel _tarefa)
        {
            var lista = await listaRepository.GetLista(_tarefa.IdLista);

            var tarefa = new Tarefa(_tarefa.Nome, _tarefa.Descricao, _tarefa.Status, lista);

            await tarefaRepository.CreateTarefa(tarefa);
        }
Esempio n. 2
0
        public async Task UpdateTarefa([FromBody] CadastroTarefaModel _tarefa)
        {
            var tarefa = await tarefaRepository.GetTarefa(_tarefa.IdTarefa);

            var lista = await listaRepository.GetLista(_tarefa.IdLista);

            tarefa.TarefaSetCampos(_tarefa.Nome, _tarefa.Descricao, _tarefa.Status, lista);

            await tarefaRepository.UpdateTarefa(tarefa);
        }
Esempio n. 3
0
        public async Task <IActionResult> GetTarefa(int idLista, int idTarefa)
        {
            var tarefa = await tarefaRepository.GetTarefa(idTarefa);

            if (tarefa == null)
            {
                return(NotFound());
            }
            else
            {
                var result = new CadastroTarefaModel(tarefa.Id, tarefa.Nome, tarefa.Descricao, idLista, tarefa.Status);

                return(Ok(result));
            }
        }