public HttpResponseMessage Post([FromBody] Tarefa t)
 {
     if (ModelState.IsValid)
     {
         using (TarefaModel model = new TarefaModel())
         {
             t.Data = DateTime.Now;
             model.Create(t);
             return(Request.CreateResponse(HttpStatusCode.OK, "Cadastrado com sucesso"));
         }
     }
     else
     {
         return(Request.CreateResponse(HttpStatusCode.PreconditionFailed, ModelState.Values));
     }
 }
        public ActionResult Create(Tarefa t)
        {
            if (ModelState.IsValid)
            {
                t.Concluida = false;
                t.Data      = DateTime.Now;

                using (TarefaModel model = new TarefaModel())
                {
                    model.Create(t);
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                ViewBag.Erro = "Preencha a descrição da tarefa.";
                return(View());
            }
        }