public async Task <IActionResult> Edit(int id, [Bind("Id,StudentId,GroupId")] GroupsStudents groupsStudents)
        {
            if (id != groupsStudents.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(groupsStudents);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GroupsStudentsExists(groupsStudents.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GroupId"]   = new SelectList(_context.Groups, "Id", "Name", groupsStudents.GroupId);
            ViewData["StudentId"] = new SelectList(_context.Students, "Id", "FullName", groupsStudents.StudentId);
            return(View(groupsStudents));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FullName,Adress,Login,Password,CardNumber,Language,Grade,Level")] Tutors tutors)
        {
            if (id != tutors.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tutors);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TutorsExists(tutors.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tutors));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Topic,GroupId,RoomId,BeginningTime,СompletionTime")] Classes classes)
        {
            if (id != classes.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(classes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClassesExists(classes.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GroupId"] = new SelectList(_context.Groups, "Id", "Language", classes.GroupId);
            ViewData["RoomId"]  = new SelectList(_context.Rooms, "Id", "Number", classes.RoomId);
            return(View(classes));
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Number,Capacity,Description")] Rooms rooms)
        {
            if (id != rooms.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rooms);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoomsExists(rooms.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rooms));
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,TutorId,Language,Level,NumberOfStudents")] Groups groups)
        {
            if (id != groups.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(groups);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GroupsExists(groups.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TutorId"] = new SelectList(_context.Tutors, "Id", "FullName", groups.TutorId);
            return(View(groups));
        }