public ResponseData EditTodos(Todos todos)
        {
            ResponseData respnonse = new ResponseData();

            if (ModelState.IsValid)
            {
                Todos todosreult = db.Todo.Find(todos.ID);
                if (todosreult != null)
                {
                    todosreult.Name            = todos.Name;
                    todosreult.IsDone          = todos.IsDone;
                    db.Entry(todosreult).State = EntityState.Modified;
                    db.SaveChanges();
                    respnonse.IsSuccess       = true;
                    respnonse.ResponseMessage = "Successfully updated";
                }
                else
                {
                    respnonse.IsSuccess       = false;
                    respnonse.ResponseMessage = "Unable To update";
                }
            }
            else
            {
                respnonse.IsSuccess       = false;
                respnonse.ResponseMessage = "Unable To update";
            }
            return(respnonse);
        }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "ID,Name,Data,Meta,Status")] Tarefas tarefas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tarefas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tarefas));
 }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "ID,Name,DueDate,Attributes,Priority")] Todos todos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(todos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(todos));
 }