Esempio n. 1
0
        public ActionResult CreateCourses(CourseViewModels model)
        {
            if (ModelState.IsValid)
            {
                Courses courses = new Courses();
                courses.CourseName = model.CourseName;

                db.Courses.Add(courses);
                db.SaveChanges();

                Teachers teachers = new Teachers();
                teachers.FirstName        = model.FirstName;
                teachers.LastName         = model.LastName;
                teachers.ShortDescription = teachers.ShortDescription;
                teachers.ImageUrl         = teachers.ImageUrl;

                teachers.TeacherId = courses.CourseId;

                db.Teachers.Add(teachers);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }


            return(View());
        }
Esempio n. 2
0
 public int Save()
 {
     return(db.SaveChanges());
 }
 public void GetFeedbacks(Feedback newfeedback)
 {
     _FeedbackContext.Add(newfeedback);
     _FeedbackContext.SaveChanges();
 }
 public void CreateTeacher(Teachers newteachers)
 {
     _musicSchoolContext.Add(newteachers);
     _musicSchoolContext.SaveChanges();
 }
 public void CreateCourse(Courses newcourses)
 {
     _musicSchoolContext.Add(newcourses);
     _musicSchoolContext.SaveChanges();
 }