dimanche 1 mai 2016

How to Update DataBase with an ActionLink in a List Page

I have an ActionLink (for update) in a list (strongly type List for display list db) page. Now I'm using the ActionLink update, change the other Family of database to a string.

    public bool Update()
        User old_user = db.Users.Where(p => p.Family == "Jacki").Single();
        old_user.Family = "Anderson";
        return Convert.ToBoolean(db.SaveChanges()); 

    public ActionResult changeFamily(User Us)
        return RedirectToAction("List");

Aucun commentaire:

Enregistrer un commentaire