Esempio n. 1
0
        public ActionResult StaffLogOn(LogOnModel model, string returnUrl)
        {
            var user = _wsClient.StaffLogin(model.UserName, model.Password);
            if (user != null)
            {
                //usermodel generated from returendinformation on staff member who has logged in to be passed
                //between views
                var userModel = new UserModel
                {   Id = user.StaffId,
                    Forename = user.StaffForename,
                    Surname = user.StaffSurname,
                    Role = "Staff",
                    UserName = user.StaffEmail
                };
                //cookie setup
                    FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
                        && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                    {
                        return Redirect(returnUrl);
                    }
                    //current view returned with validation due to login fail
                        return RedirectToAction("StaffSummary", "Home", userModel);
              }

                ModelState.AddModelError("", "The user name or password provided is incorrect.");
                //current view returned with validation due to login fail
            return View();
        }
Esempio n. 2
0
 /// <summary>
 /// Timetable for student view returned
 /// </summary>
 /// <param name="usermodel"></param>
 /// <returns></returns>
 public ActionResult Timetable(UserModel usermodel)
 {
     return View("Timetable", usermodel);
 }
Esempio n. 3
0
 /// <summary>
 /// Summary view for student returned
 /// </summary>
 /// <param name="userModel"></param>
 /// <returns></returns>
 public ActionResult Summary(UserModel userModel)
 {
     return View("Summary", userModel);
 }