public ActionResult ClasstoEnroll(EnrollModel enrollModel)
        {
            var sessionuser = (Elearning.Website.Models.UserModel)Session["User"];
            var userid      = sessionuser.Id;
            var newclassid  = enrollModel.ClassId;

            userClassManager.Add(userid, newclassid);

            return(Redirect("~/Home/EnrolledClasses"));
        }
Beispiel #2
0
 public ActionResult UpdateEnrollment(EnrollModel model)
 {
     try
     {
         EnrollRepo  Lr     = new EnrollRepo();
         EnrollModel model1 = Lr.dropdownrepo();
         return(View("UpdateEnrollment", model1));
     }
     catch (SqlException)
     {
         ViewBag.duplicatemessage = "Please Enter All The Data";
         return(RedirectToAction("UpdateEnrollment", model));
     }
 }
Beispiel #3
0
 public ActionResult UpdateEnrollment(EnrollModel model, FormCollection form)
 {
     try
     {
         EnrollRepo Lr = new EnrollRepo();
         if (Lr.UpdateEnrolledRepo(model, Session["Accountid"], form))
         {
             ViewBag.SuccessMessage = "Enrollment Updated successfully";
         }
         return(RedirectToAction("GetAllCourseEnrolled"));
     }
     catch (SqlException)
     {
         ViewBag.duplicatemessage = "SQl Error";
         return(RedirectToAction("GetAllCourseEnrolled"));
     }
 }
        public ActionResult Enroll()
        {
            if (Session["User"] == null)

            {
                return(RedirectToAction("login", "Home", new { returnUrl = "Enroll" }));
            }

            var classes = classManager.Classes
                          .Select(t => new Ziglearning.Website.Models.ClassModel(t.Id, t.Name, t.Description, t.Price))
                          .ToArray();
            var model = new EnrollModel
            {
                Classes = classes
            };

            return(View(model));
        }
Beispiel #5
0
        public ActionResult AddEnrollDetails(int id, EnrollModel obj)
        {
            if (Session["UserId"] != null && Session["Accountid"] != null)
            {
                try
                {
                    EnrollRepo EnrRepo = new EnrollRepo();

                    EnrRepo.AddEnrollRepo(obj, Session["UserId"]);

                    return(RedirectToAction("GetAllCourseEnrolled"));
                }
                catch
                {
                    return(View());
                }
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
        public bool AddEnrollRepo(EnrollModel obj, object s1)
        {
            connection();
            cmd.Parameters.AddWithValue("@catid", obj.catId);
            cmd.Parameters.AddWithValue("@courseid", obj.courseId);
            cmd.Parameters.AddWithValue("@instructorid", obj.instructorId);
            cmd.Parameters.AddWithValue("@userid", s1);
            cmd.Parameters.AddWithValue("@enrollmentid", 1);
            cmd.Parameters.AddWithValue("@status", "Create");
            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            if (i >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool UpdateEnrolledRepo(EnrollModel obj, object s1, FormCollection form)
        {
            connection();
            int s2 = Convert.ToInt32(form["EnrollmentList"]);

            cmd.Parameters.AddWithValue("@id", obj.Id);
            cmd.Parameters.AddWithValue("@accountid", s1);
            cmd.Parameters.AddWithValue("@enrollmentid", s2);
            cmd.Parameters.AddWithValue("@status", "Update");
            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            if (i >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public EnrollModel dropdownrepo()
 {
     model = new EnrollModel();
     connection();
     con.Open();
     using (SqlCommand cmd1 = new SqlCommand("select enroll_id,enroll_status from enrollment_status", con))
     {
         DataSet        ds = new DataSet();
         SqlDataAdapter da = new SqlDataAdapter(cmd1);
         da.Fill(ds);
         List <EnrollModel> Enroll = new List <EnrollModel>();
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             EnrollModel uobj = new EnrollModel();
             uobj.Id             = Convert.ToInt32(ds.Tables[0].Rows[i]["enroll_id"].ToString());
             uobj.enrollmentType = ds.Tables[0].Rows[i]["enroll_status"].ToString();
             Enroll.Add(uobj);
         }
         model.EnrollmentList = Enroll;
     }
     con.Close();
     return(model);
 }
        public async Task <bool> EnrollStudent(EnrollModel model)
        {
            var check = await AddEnrollCountToCourse(model.CourseId);

            if (!check)
            {
                return(false);
            }
            var enroll = new Enrollments
            {
                CourseId  = model.CourseId,
                Name      = model.Name,
                Surname   = model.Surname,
                Address   = model.Address,
                Telephone = model.Telephone,
                Email     = model.Email,
                Date      = DateTime.Now
            };

            context.Enrollments.Add(enroll);
            await context.SaveChangesAsync();

            return(true);
        }
Beispiel #10
0
 public string Post(EnrollModel enrollModel)
 {
     return("value");
 }