Esempio n. 1
0
 public ActionResult Edit([Bind(Include = "id,firstname,lastname,email,password,phone")] Identity identity)
 {
     if (ModelState.IsValid)
     {
         db.Entry(identity).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", new { id = identity.id }));
     }
     return(View(identity));
 }
Esempio n. 2
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name")] FModel fModel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(fModel).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(fModel));
        }
Esempio n. 3
0
        public IActionResult ChangeStatus(int id, bool status)
        {
            var updateTodo = _identityDBContext.Todo.Find(id);

            if (updateTodo != null)
            {
                //update the Todo item in the database
                updateTodo.Complete = !status;
                //creates a log of changes for this entry. A way to tracking our work
                _identityDBContext.Entry(updateTodo).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                _identityDBContext.Update(updateTodo);
                _identityDBContext.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }