public async Task <IActionResult> Create([Bind("ID,Username,Password")] Models.Admin admin) { if (ModelState.IsValid) { _context.Add(admin); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(admin)); }
public async Task <IActionResult> Create([Bind("Id,Name,Address")] Campus campus) { if (ModelState.IsValid) { _context.Add(campus); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(campus)); }
public async Task <IActionResult> Create([Bind("Id,EclassId,Name,Gender,Nation,EnrollmentDate,PhoneNumber,Email,Password")] Models.Student student) { if (ModelState.IsValid) { _context.Add(student); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["EClassID"] = new SelectList(_context.Eclass, "Id", "Id", student.EclassId); return(View(student)); }
public async Task <IActionResult> Create([Bind("Id,DepartmentId,Title")] Course course) { SetViewData(); if (ModelState.IsValid) { _context.Add(course); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["DepartmentID"] = new SelectList(_context.Department, "Id", "Name", course.DepartmentId); return(View(course)); }
public async Task <IActionResult> Create([Bind("Id,CampusId,InstructorId,Name,StartTime")] Department department) { if (ModelState.IsValid) { _context.Add(department); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["InstructorID"] = new SelectList(_context.Instructor, "Id", "Name", department.InstructorId); ViewData["CampusID"] = new SelectList(_context.Campus, "Id", "Name", department.CampusId); return(View(department)); }
public async Task <IActionResult> Create([Bind("ID,InstructorID,MajorID,StartYear,Order")] Eclass eClass) { SetViewData(); if (ModelState.IsValid) { _context.Add(eClass); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["InstructorID"] = new SelectList(_context.Instructor, "Id", "Name", eClass.InstructorId); ViewData["MajorID"] = new SelectList(_context.Major, "Id", "Title", eClass.MajorId); return(View(eClass)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DepartmentId,Name,Gender,Nation,HireDate,PhoneNumber,Email,Academic,OfficeLocation,Password")] Models.Instructor instructor) { if (id != instructor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(instructor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InstructorExists(instructor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Profile")); } return(RedirectToAction("Profile")); }