Exemple #1
0
        public IHttpActionResult onlineexam()
        {
            StudentManagementSystemEntities nd = new StudentManagementSystemEntities();
            IList <OnlineExamClass>         oe = nd.onlineexams.Include("onlineexam").Select(x => new OnlineExamClass()
            {
                Qid         = x.Qid,
                Question    = x.Question,
                option1     = x.option1,
                option2     = x.option2,
                option3     = x.option3,
                option4     = x.option4,
                Corrections = x.Corrections
            }).ToList <OnlineExamClass>();

            return(Ok(oe));
        }
Exemple #2
0
 public ActionResult Index(User user)
 {
     if (ModelState.IsValid)
     {
         using (StudentManagementSystemEntities _db = new StudentManagementSystemEntities())
         {
             var obj =
                 _db.Users.Where(m => m.username.Equals(user.username) && m.password.Equals(user.password))
                 .FirstOrDefault();
             if (obj != null)
             {
                 Session["UserId"]   = user.id.ToString();
                 Session["UserName"] = user.username.ToString();
                 return(RedirectToAction("Index", "Home"));
             }
             else
             {
                 ModelState.AddModelError("", "The User Name And Password Is Incorrect!");
             }
         }
     }
     return(View(user));
 }