コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }