Exemplo n.º 1
0
        public IHttpActionResult AddLecture([FromBody] Lecture lecture)
        {
            lecture.Insert(BonusEnum.UpsertType.Insert);
            var id = lecture.GetLectureID();

            return(Ok(id));
        }
Exemplo n.º 2
0
        public IHttpActionResult RescheduleLecture(int lecture_id, int times)
        {
            var lecture = LectureHelper.GetById(lecture_id);

            for (int i = 0; i < times; i++)
            {
                var new_lec = new Lecture(lecture.From.AddDays(7 * (i + 1)), lecture.To.AddDays(7 * (i + 1)),
                                          lecture.CourseID);
                new_lec.Insert();
            }

            return(Ok(new ApiCallbackMessage("Success", true)));
        }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "LectureID,From,To,CheckInEnabled,CourseID")] Lecture lecture)
        {
            if (ModelState.IsValid)
            {
                if (lecture.From >= lecture.To)
                {
                    ViewBag.DateError = "Lecture from cannot be equal or after To";
                    return(View(lecture));
                }

                lecture.Insert();
                return(RedirectToAction("Index", new { courseId = lecture.CourseID }));
            }
            return(View(lecture));
        }
Exemplo n.º 4
0
        public ActionResult Edit([Bind(Include = "LectureID,From,To,CheckInEnabled,CourseID")] Lecture lecture)
        {
            if (ModelState.IsValid)
            {
                if (lecture.From >= lecture.To)
                {
                    ViewBag.DateError = "Lecture from cannot be equal or after To";
                    return(View(lecture));
                }

                lecture.Insert();
                return(RedirectToAction("Index", lecture.CourseID));
            }

            ViewBag.Attendees = AttendeeHelper.GetAttendeesForLecture(lecture.LectureID);

            return(View(lecture));
        }
Exemplo n.º 5
0
        public void AddLecture(DateTime from, DateTime to, int courseId)
        {
            var lecture = new Lecture(from, to, courseId);

            lecture.Insert();
        }