Пример #1
0
        public async Task <ActionResult> Create([Bind(Include = "TarefaId,Titulo,Concluida")] Tarefa tarefa)
        {
            if (ModelState.IsValid)
            {
                db.Tarefa.Add(tarefa);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(tarefa));
        }
Пример #2
0
        public async Task <ActionResult> Create([Bind(Include = "UsuarioId,Nome,Email,Senha,PerfilId")] Usuario usuario)
        {
            if (ModelState.IsValid)
            {
                db.Usuario.Add(usuario);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.PerfilId = new SelectList(db.Perfil, "PerfilId", "Nome", usuario.PerfilId);
            return(View(usuario));
        }
 public async Task <int> SaveChanges()
 {
     return(await Db.SaveChangesAsync());
 }