public IHttpActionResult AddLecture([FromBody] Lecture lecture) { lecture.Insert(BonusEnum.UpsertType.Insert); var id = lecture.GetLectureID(); return(Ok(id)); }
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))); }
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)); }
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)); }
public void AddLecture(DateTime from, DateTime to, int courseId) { var lecture = new Lecture(from, to, courseId); lecture.Insert(); }