public async Task <ActionResult> Edit([Bind(Include = "IdClassRoom,Name")] ClassRoomViewModels classRoomViewModels) { if (ModelState.IsValid) { var entity = await db.ClassRooms.FindAsync(classRoomViewModels.IdClassRoom); entity.ClassRoomName = classRoomViewModels.Name; db.Entry(entity).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(classRoomViewModels)); }
public async Task <ActionResult> Edit([Bind(Include = "IdLesson,Name")] LessonViewModels lessonViewModels) { if (ModelState.IsValid) { var entity = await db.Lessons.FindAsync(lessonViewModels.IdLesson); entity.LessonName = lessonViewModels.Name; db.Entry(entity).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(lessonViewModels)); }
public async Task <ActionResult> Edit([Bind(Include = "IdStudent,Username,Name,SurName")] StudentViewModels studentViewModels) { if (ModelState.IsValid) { var entity = await db.Students.FindAsync(studentViewModels.IdStudent); entity.StudentName = studentViewModels.Name; entity.StudentSurname = studentViewModels.SurName; db.Entry(entity).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(studentViewModels)); }