コード例 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TN_User EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTN_User(TN_User tN_User)
 {
     base.AddObject("TN_User", tN_User);
 }
コード例 #2
0
        public ActionResult Index(UserLogin model)
        {
            if (ModelState.IsValid)
            {
                var getUser = db.TN_User.FirstOrDefault(m => m.SBD.Equals(model.SBD.Trim().Replace(" ", ""), StringComparison.OrdinalIgnoreCase));
                if (getUser == null)
                {
                    getUser = new TN_User()
                    {
                        SBD = model.SBD.Trim().Replace(" ", ""),
                        FullName = model.FullName.Trim()
                    };
                    db.TN_User.AddObject(getUser);
                    db.SaveChanges();
                }
                var exam = (TN_Exam)Session[SessionKey.ExamObject];
                Session[SessionKey.UserObject] = getUser;
                var getExamUser = db.TN_ExamUser.FirstOrDefault(m => m.UserID == getUser.ID && m.ExamID == exam.ID);
                if (getExamUser != null)
                {
                    Session[SessionKey.ExamUserObject] = getExamUser;
                    return RedirectToAction("Test", "Home");
                }

                return RedirectToAction("ConfirmTest", "Home");
            }
            return View(model);
        }
コード例 #3
0
 /// <summary>
 /// Create a new TN_User object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="sBD">Initial value of the SBD property.</param>
 /// <param name="fullName">Initial value of the FullName property.</param>
 public static TN_User CreateTN_User(global::System.Int32 id, global::System.String sBD, global::System.String fullName)
 {
     TN_User tN_User = new TN_User();
     tN_User.ID = id;
     tN_User.SBD = sBD;
     tN_User.FullName = fullName;
     return tN_User;
 }