Ejemplo n.º 1
0
        public async Task <ActionResult> Create([Bind(Include = "IdClassRoom,Name")] ClassRoomViewModels classRoomViewModels)
        {
            if (ModelState.IsValid)
            {
                db.ClassRooms.Add(new ClassRoom {
                    ClassRoomName = classRoomViewModels.Name
                });
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(classRoomViewModels));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Create([Bind(Include = "IdStudent,Username,Name,SurName")] StudentViewModels studentViewModels)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(new Student {
                    StudentName = studentViewModels.Name, StudentSurname = studentViewModels.SurName
                });
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(studentViewModels));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Create([Bind(Include = "IdLesson,Name")] LessonViewModels lessonViewModels)
        {
            if (ModelState.IsValid)
            {
                db.Lessons.Add(new Lesson
                {
                    LessonName = lessonViewModels.Name,
                });
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(lessonViewModels));
        }