public async Task <ActionResult> Index() { StudentProgressBL studProgressBL = new StudentProgressBL(); string studProgress = await studProgressBL.GetStudent_Progresses(); List <Student_Progress> cust = JsonConvert.DeserializeObject <List <Student_Progress> >(studProgress); return(View(cust)); }
public async Task <ActionResult> Edit(int id) { StudentProgressBL studentProgressBL = new StudentProgressBL(); string Courses = await studentProgressBL.GetStudent_Progresses(); List <Student_Progress> cust = JsonConvert.DeserializeObject <List <Student_Progress> >(Courses); foreach (var i in cust) { if (i.CourseID == id && i.UserName == Session["username"].ToString()) { return(View(i)); } } return(View()); }
public async Task <ActionResult> Edit(Student_Progress s) { StudentProgressBL studentProgressBL = new StudentProgressBL(); //s.Test_scores = 100; s.UserName = Session["username"].ToString(); string course = JsonConvert.SerializeObject(s); string result = await studentProgressBL.EditP(course); if (result == "true") { string progress = await studentProgressBL.GetStudent_Progresses(); List <Student_Progress> cust = JsonConvert.DeserializeObject <List <Student_Progress> >(progress); return(View("Index", cust)); } return(View()); }
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>")); }