コード例 #1
0
 public ActionResult CalculateMarks()
 {
     CourseListModel obmodel = new CourseListModel();
     // obmodel.CourseListCollection = GetCourseList();
        ////////// obmodel.CourseListCollection =  GetCourseList();
     obmodel.StudentListCollection = GetStudentIdList();
     return View(obmodel);
 }
コード例 #2
0
        public ActionResult CalculateMarks(FormCollection c)
        {
            CourseListModel obmodel = new CourseListModel();
            obmodel.CourseListCollection = GetCourseList();
            obmodel.StudentListCollection = GetStudentIdList();
              //  obmodel.CourseListCollection = GetStudentIdList();
               // CourseListModel obmodel = new CourseListModel();/////////////

            if (c["addmarks"] != null)
            {
                string s = c["sidata"].ToString();
                ViewBag.siddata = s;
                ViewBag.Msgss = "okk";
                return View(obmodel);

            }
            if (c["savemarks"] != null)
            {
                MarksInputList mil = null;

                string sid1 = c["sidata"].ToString();
                string str = c["marksdata"].ToString();
                string[] splitstr = str.Split(',');
                int i=0;
                bool flag = false;
                foreach(string ss1 in splitstr)
                {
                 //= int.Parse(c["MarksInput"].ToString();
                    string cid = "c-"+ss1.ToString();
                    int marks = int.Parse(c[cid].ToString());
                   // string sid = "53";

                    mil = new MarksInputList();
                    mil.CourseId = cid.Substring(2);
                    mil.StId = sid1;
                    mil.MarksInput = marks;
                    if (SaveMarks(mil))
                        flag = true;

                }
                if (flag == true)
                    ViewBag.msgg = "Marks saved...";
                else
                    ViewBag.msgg = "Not saving..";
             }
              //  obmodel = new CourseListModel();
               // obmodel.CourseListCollection = GetCourseList();

              return View(obmodel);
        }
コード例 #3
0
        public ActionResult ShowAll()
        {
            CourseListModel obmodel = new CourseListModel();
            obmodel.CourseListCollection = GetCourseList();
            if (TempData["Msg"] != null)
            {
                ////////ViewBag.Addmsg = "Yes";
                ViewBag.Msg1 = "done";
                ViewBag.Msg2 = "Updated..";

            }
            return View(obmodel);
        }
コード例 #4
0
        public ActionResult ShowAll(FormCollection c)
        {
            CourseListModel obmodel = new CourseListModel();
            obmodel.CourseListCollection = GetCourseList();////goTo method
            if (c["add"] != null)
            {
                ViewBag.Addmsg = "Yes";
                return View(obmodel);
            }

            if (c["save"] != null)
            {
                CourseList cl = new CourseList();
                cl.CourseId = c["cid1"].ToString().Substring(0,c["cid1"].ToString().Length-1);

                cl.CourseName = c["cname1"].ToString().Substring(0,c["cname1"].ToString().Length-1);

                cl.CourseMarks = int.Parse(c["cmarks1"].ToString());

                if (SaveData(cl))
                    TempData["Msg"] = "Info added..";
                else
                    TempData["Msg"] = "Error";

                return  RedirectToAction("ShowAll","CourseDetails");
            }
            if (c["show"] != null)
            {

                ViewBag.Addmsg1 = "ok";
                return View(obmodel);
            }

            else if (c["Update"] != null)
            {
                string cid = c["cid1"].ToString();
                string cname = c["cname1"].ToString();
                int cmks = int.Parse(c["cmarks"].ToString());

                if (UpdateMarks(cid, cname, cmks))
                    //ViewBag.Msg = "Updated CourseInfo";
                    TempData["Msg"] = "Info added..";
                else
                    ViewBag.Msg = "Not Updatted";

                return RedirectToAction("ShowAll", "CourseDetails");
            }
            else if (c["Remove"] != null)
            {
                string idd = c["cid1"].ToString();
                if (DeleteCourse(idd))
                    ViewBag.Msg = "Deleted Course";
                else
                    ViewBag.Msg = "Not Deleted";

                return RedirectToAction("ShowAll", "CourseDetails");

            }
             return View(obmodel);
        }