public async Task <IActionResult> Edit(int id, [Bind("id,year_title,status")] Year year) { if (id != year.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(year); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!YearExists(year.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(year)); }
public async Task <IActionResult> Edit(int id, [Bind("id,class_id,course_id,teacher_id,year_id,class_time")] Routine routine) { if (id != routine.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(routine); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoutineExists(routine.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["class_id"] = new SelectList(_context.Class, "id", "class_name", routine.class_id); ViewData["course_id"] = new SelectList(_context.Course, "id", "course_code", routine.course_id); ViewData["teacher_id"] = new SelectList(_context.Teacher, "id", "name", routine.teacher_id); ViewData["year_id"] = new SelectList(_context.Year, "id", "year_title", routine.year_id); return(View(routine)); }
public async Task <IActionResult> Edit(int id, [Bind("id,name,phone,address,user_name,password")] Teacher teacher) { if (id != teacher.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teacher); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeacherExists(teacher.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(teacher)); }
public async Task <IActionResult> Edit(string id, [Bind("user_name,password,type")] User user) { if (id != user.user_name) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.user_name)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("id,course_code,course_name,class_id")] Course course) { if (id != course.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(course); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(course.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["class_id"] = new SelectList(_context.Class, "id", "class_name", course.class_id); return(View(course)); }
public async Task <IActionResult> Edit(int id, [Bind("Fee_Id,F_Name")] Fees fees) { if (id != fees.Fee_Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fees); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FeesExists(fees.Fee_Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(fees)); }
public async Task <IActionResult> Edit(int id, [Bind("id,class_name")] Class @class) { if (id != @class.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(@class); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClassExists(@class.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(@class)); }
public async Task <IActionResult> Edit(int id, [Bind("id,name,phone,address,user_name,password,class_id,year_id")] Student student) { if (id != student.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(student); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(student.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["class_id"] = new SelectList(_context.Class, "id", "class_name", student.class_id); ViewData["year_id"] = new SelectList(_context.Year, "id", "year_title", student.year_id); return(View(student)); }
public async Task <IActionResult> Edit(string id, [Bind("Std_Id,Name,Birth_Date,Gender,Contact,Address,Father_Name,Mother_Name,Class,M_Id")] Students students) { if (id != students.Std_Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(students); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentsExists(students.Std_Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["M_Id"] = new SelectList(_context.Months, "M_Id", "M_Name", students.M_Id); return(View(students)); }
public async Task <IActionResult> Edit(int id, [Bind("id,Std_Id,Fee_Id,Amount,M_Id")] Payment payment) { if (id != payment.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(payment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentExists(payment.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Fee_Id"] = new SelectList(_context.Fees, "Fee_Id", "F_Name", payment.Fee_Id); ViewData["M_Id"] = new SelectList(_context.Months, "M_Id", "M_Name", payment.M_Id); ViewData["Std_Id"] = new SelectList(_context.Students, "Std_Id", "Std_Id", payment.Std_Id); return(View(payment)); }
public async Task <IActionResult> Edit(int id, [Bind("id,std_id,name,age,gender,Class,paid,due")] StudentInfo studentInfo) { if (id != studentInfo.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(studentInfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentInfoExists(studentInfo.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(studentInfo)); }
public void Update <T>(T entity) where T : class { _context.Update(entity); }