示例#1
0
        public ActionResult Create([Bind(Include = "Id,Name,Description,Title,Start,End")] Course course)
        {
            if (ModelState.IsValid)
            {
                coursesRepository.AddCourse(course);
                return(RedirectToAction("Index"));
            }

            return(View(course));
        }
示例#2
0
 public bool AddCourse([FromBody] CoursesModel CoursesModel)
 {
     try
     {
         CoursesRepository _searchRepository = new CoursesRepository();
         var Result = _searchRepository.AddCourse(CoursesModel);
         return(Result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
示例#3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            UsersRepository   userRepo             = new UsersRepository();
            CoursesRepository courseRepo           = new CoursesRepository();
            UserCoursesEnrollmentRepository   ucer = new UserCoursesEnrollmentRepository();
            TeacherCourseEnrollmentRepository tcer = new TeacherCourseEnrollmentRepository();

            // oded tests
            string        filePath = "C:/123.txt";
            string        fileName = "lecture9";
            ClientActions ca       = new ClientActions();



            courseRepo.DeleteCourse(Guid.Parse("024a1b90-24ac-493a-be70-f5fe6a5c0bf4"));
            // Create new user
            //userRepo.AddUser("yair7", false);
            var user = userRepo.GetUsers("yair4");

            MessageBox.Show(user.First().UserName);

            // Create new course
            var courseId = Guid.NewGuid();

            courseRepo.AddCourse(courseId, "somenewname");
            var course = courseRepo.GetCourse(courseId);

            MessageBox.Show(course.Count().ToString());

            // User course enrollment
            ucer.AddCourseToUser("yair4", courseId);
            var courseForUser = ucer.GetCoursesForUser("yair4");

            MessageBox.Show(courseForUser.Count().ToString());

            // Teacher course enrollment
            tcer.AddCourseToTeacher("yair4", courseId);
            var courseForTeacher = tcer.GetCoursesForTeacher("yair4");

            MessageBox.Show(courseForTeacher.Count().ToString());
            Application.Run(new Form2());
        }
        public ActionResult AddCourse(tblCourse objCourse, HttpPostedFileBase file)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    int     rows        = 0;
                    TblUser sessionUser = (TblUser)Session["UserSession"];
                    objCourse.createdBy = sessionUser.UserId;
                    objCourse.tenantId  = sessionUser.TenantId;
                    newException.AddDummyException(":- " + objCourse.tenantId);
                    objCourse.ZipFile = file;
                    if (objCourse.ContentModuleId > 0)
                    {
                        rows = cc.EditCourse(objCourse);
                    }
                    else
                    {
                        rows = cc.AddCourse(objCourse);
                    }


                    if (rows != 0)
                    {
                        TempData["CourseMessage"] = "Course Saved Successfully";
                        return(View("AddNewCourse", objCourse));
                        //return RedirectToAction("Index");
                    }
                    else
                    {
                        return(View("AddNewCourse", objCourse));
                    }
                }
                return(View("AddNewCourse", objCourse));
            }
            catch (Exception ex)
            {
                newException.AddException(ex);
                return(View("AddNewCourse"));
            }
        }
 private void AddCourseButton_Click(object sender, EventArgs e)
 {
     if (CourseTextBox.Text.Length == 0)
     {
         Warning();
     }
     else
     {
         try
         {
             bool isAdded = CoursesRepository.AddCourse(CourseTextBox.Text, int.Parse(ClassNumbersComboBox.Text));
             if (isAdded == true)
             {
                 CourseTextBox.Text = "";
             }
         }
         catch (Exception)
         {
             MessageBox.Show("Molimo unesite broj odjeljenja");
         }
     }
 }
示例#6
0
 public void AddCourse(Guid courseId, string courseName)
 {
     m_CoursesRepository.AddCourse(courseId, courseName);
 }