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)); }
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)); }
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)); }