コード例 #1
0
        private void createFourEntries()
        {
            emptyTable();
            isUserListEmpty();

            rip.createUser();
            rap.createUser();
            rup.createUser();
            andersAnd.createUser();

            UsersTableModel        usersTableModel = new UsersTableModel();
            List <UsersTableModel> utms            = usersTableModel.getUserList();

            Assert.IsTrue(utms.Count == 4, "Der skulle være 4 personer i Users. Der er " + utms.Count);
        }
コード例 #2
0
        public ActionResult Create([Bind(Include = "brugerId,createTs,password,salt,email,prim,erAdmin")] UsersTableModel usersTableModel)
        {
            if (ModelState.IsValid)
            {
                /*
                 * db.UsersTableModel.Add(usersTableModel);
                 * db.SaveChanges();
                 */

                if (usersTableModel.userExists())
                {
                    ModelState.AddModelError("", "Brugeren eksisterer allerede - prøv at hedde noget andet");
                }
                else
                {
                    usersTableModel.createUser();
                    new LogonModel().create(usersTableModel.brugerId);
                    return(RedirectToAction("Index"));
                }
            }

            return(View(usersTableModel));
        }