Exemplo n.º 1
0
 public void CreateNewCourse(Course course)
 {
     var test= courseContext.Courses.Max(z =>  z.CourseID.Substring(2));
       course.CourseID = "CR" + (Convert.ToInt32(test)+1);
     courseContext.Courses.Add(course);
     courseContext.SaveChanges();
 }
Exemplo n.º 2
0
        public ActionResult Create(Course course)
        {
            if (ModelState.IsValid)
            {
                CreateModificationDetails(course);
                _repository.CreateNewCourse(course);
                return RedirectToAction("Index");
            }

            return View(course);
        }
Exemplo n.º 3
0
 public void UpdateCourse(Course course)
 {
     courseContext.Entry(course).State = EntityState.Modified;
     courseContext.SaveChanges();
 }
Exemplo n.º 4
0
 public void CreateModificationDetails(Course course)
 {
     course.ModificationType = "Created";
     ModificationDetails(course);
 }
Exemplo n.º 5
0
 public void ModificationDetails(Course course)
 {
     course.ModifiedDate = DateTime.Now;
     course.ModifiedBy = Convert.ToString(Session["UserID"]);
 }
Exemplo n.º 6
0
 public ActionResult Edit(Course course)
 {
     if (ModelState.IsValid)
     {
         UpdateModificationDetails(course);
         _repository.UpdateCourse(course);
         return RedirectToAction("Index");
     }
     return View(course);
 }