Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }