Exemplo n.º 1
0
        public async Task <ActionResult> Enroll(int id)
        {
            Student_Progress sp = new Student_Progress();

            sp.CourseID = id;
            sp.UserName = Session["username"].ToString();
            string add    = JsonConvert.SerializeObject(sp);
            string result = await studentProgressBL.EnrollNow(add);

            if (result == "true")
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Enrolled Succesfully'); window.location.href = '/StudentCourse/Index'</script>"));
            }
            return(Content("<script language='javascript' type='text/javascript'>alert('You have already enrolled this course'); window.location.href = '/StudentCourse/Details/" + id.ToString() + "'</script>"));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Assign()
        {
            int               cid               = Convert.ToInt32(Request["txtCourseid"].ToString());
            string            username          = Request["txtUsername"].ToString();
            StudentProgressBL studentProgressBL = new StudentProgressBL();
            Student_Progress  sp = new Student_Progress();

            sp.CourseID = cid;
            sp.UserName = username;
            string add    = JsonConvert.SerializeObject(sp);
            string result = await studentProgressBL.EnrollNow(add);

            if (result == "true")
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Assigned Succesfully'); window.location.href = '/Course/Index'</script>"));
            }
            return(Content("<script language='javascript' type='text/javascript'>alert('Course Not Assigned. Please check username/CourseID'); window.location.href = '/Course/Details/" + cid.ToString() + "'</script>"));
        }