Ejemplo n.º 1
0
        // GET: Lession
        public ActionResult Index(int uid)
        {
            try
            {
                Lesson currentLesson = dataContext.Lessons.Where(x => x.ID == uid).FirstOrDefault();

                ViewBag.Lesson = dataAdapter.Chain(currentLesson);

                if (currentLesson.Order > 1)
                {
                    List <Lesson> lstPreviousLessions = dataContext.Lessons.Take(currentLesson.Order - 1).ToList <Lesson>();

                    ViewBag.PreviousLessons = dataAdapter.Convert(lstPreviousLessions);
                }
                else
                {
                    List <Lesson> lstPreviousLessions = new List <Lesson>();

                    ViewBag.PreviousLessons = dataAdapter.Convert(lstPreviousLessions);
                }

                List <Lesson> lstNextLessions = dataContext.Lessons.Skip(currentLesson.Order).ToList <Lesson>();

                ViewBag.NextLessons = dataAdapter.Convert(lstNextLessions);

                return(View());
            }
            catch (Exception e)
            {
                return(HttpNotFound("I cannot found your Lesson! :("));
            }
        }
Ejemplo n.º 2
0
 // GET: Course/Detail
 public ActionResult Detail(int uid)
 {
     try
     {
         Course course = dataContext.Courses.Where(x => x.ID == uid).FirstOrDefault();
         ViewBag.Course = dataAdapter.Chain(course);
         return(View("Detail"));
     } catch (Exception e)
     {
         return(HttpNotFound("Cannot find your course!"));
     }
 }
Ejemplo n.º 3
0
        // GET: Instructor/Detail
        public ActionResult Detail(string uid)
        {
            try
            {
                Instructor Instructor = dataContext.Instructors.Where(x => x.UID == uid).FirstOrDefault();

                ViewBag.Instructor = dataAdapter.Chain(Instructor);

                return(View("Detail"));
            }catch (Exception e)
            {
                return(HttpNotFound("I cannot found your Instructor! :("));
            }
        }
        // GET: Technology/Detail
        public ActionResult Detail(int uid)
        {
            try
            {
                Technology technology = dataContext.Technologies.Where(x => x.ID == uid).FirstOrDefault();

                ViewBag.Technology = dataAdapter.Chain(technology);

                return(View("Detail"));
            } catch (Exception e)
            {
                return(HttpNotFound("I cannot find your Technology"));
            }
        }
Ejemplo n.º 5
0
        public ActionResult SignIn(SigninModel signinModel)
        {
            if (ModelState.IsValid)
            {
                Student currentUser = dataContext.Students.Where(x => x.Email == signinModel.Email && x.Password == signinModel.Password).FirstOrDefault();
                if (currentUser != null)
                {
                    FormsAuthentication.SetAuthCookie(currentUser.ID.ToString(), true);
                    System.Web.HttpContext.Current.Session["currentUser"] = dataAdapter.Chain(currentUser);
                    return(RedirectToAction("Index", "LandingPage"));
                }
                else
                {
                    ViewBag.Error = "Email or Password is not valid!";
                }
            }

            return(View());
        }