private void updateEmail() { UsersTableModel usersTableModel = new UsersTableModel(); string brugerId = "AndersAnd"; usersTableModel.getUser(brugerId); Assert.AreEqual(brugerId, usersTableModel.brugerId, "Kan ikke finde " + brugerId); Assert.AreEqual(andersAndEmail, usersTableModel.email, "Forkert email " + usersTableModel.email); usersTableModel.email = andersAndEmailNew; usersTableModel.updateUser(); usersTableModel.email = null; usersTableModel.getUser(brugerId); Assert.AreEqual(andersAndEmailNew, usersTableModel.email, "Forkert email " + usersTableModel.email); }
public ActionResult Edit([Bind(Include = "brugerId,createTs,password,salt,email,prim,erAdmin")] UsersTableModel usersTableModel) { if (sessiondUserId() == null || sessiondUserId() == "") { return(RedirectToAction("logIn")); } if (ModelState.IsValid) { /* * db.Entry(usersTableModel).State = EntityState.Modified; * db.SaveChanges(); */ usersTableModel.updateUser(); return(RedirectToAction("Index")); } return(View(usersTableModel)); }