// GET: Instructors/Delete/5 public async Task <IActionResult> Delete(int?id, [FromServices] IInstructorService service) { if (!id.HasValue) { return(NotFound()); } var hasPreviousError = TempData["HasError"] != null && Convert.ToBoolean(TempData["HasError"]); var message = Convert.ToString(TempData["Message"]); var instructor = await service.GetInstructorByIdForDetailAsync(id.Value); if (instructor == null) { // deleted by another user in previous delete request if (hasPreviousError) { TempData["Message"] = message; TempData["HasError"] = hasPreviousError; return(RedirectToAction(nameof(Index))); } return(NotFound()); // new delete request } return(View($"{_viewFolder}Delete.cshtml", instructor)); }
public InstructorController( ILogger <InstructorController> logger, IInstructorService instructorService) { this.logger = logger; this.instructorService = instructorService; }
// GET: Instructors public async Task <IActionResult> Index(int?id, int?courseId, [FromServices] IInstructorService service) { var viewModel = new InstructorListDto(); try { viewModel.Instructors = await service.ListAllInstructorsAsync(); if (id.HasValue) { ViewData["InstructorId"] = id.Value; viewModel.Courses = await service.ListAllInstructorCoursesAsync(id.Value); } if (courseId.HasValue) { ViewData["CourseId"] = courseId.Value; viewModel.Enrollments = await service.ListAllStudentsEnrolledInCourseAsync(courseId.Value); } } catch (Exception ex) { _logger.LogError(ex, "Exception in Index: " + ex.Message); ViewBag.HasError = true; ViewBag.Message = Constants.ERROR_MESSAGE_STANDARD + ": " + ex.Message; } return(View($"{_viewFolder}Index.cshtml", viewModel)); }
public EvaluationController(IEvaluationService service, IUserService userService, IStudentService studentService, IInstructorService instructorService) { this._service = service; this._userService = userService; this._studentService = studentService; this._instructorService = instructorService; }
public InstructorsController(IInstructorService instructorService, ICourseService courseService, ICityService cityService, ICourseInstructorService courseInstructorService) { _instructorService = instructorService; _courseService = courseService; _cityService = cityService; _courseInstructorService = courseInstructorService; }
public async Task <IActionResult> PostEdit( int?id, InstructorAddEditDto instructorDto, [FromServices] IInstructorService service) { if (!id.HasValue || id.Value != instructorDto.InstructorId) { return(NotFound()); } if (ModelState.IsValid) { try { await service.UpdateInstructorAndSaveAsync(instructorDto); } catch (GeneralException ex) { ViewBag.HasError = true; ViewBag.Message = ex.Message; } catch (Exception ex) { ViewBag.HasError = true; ViewBag.Message = Constants.ERROR_MESSAGE_STANDARD + ": " + ex.Message; } return(RedirectToAction(nameof(Index))); } await PopulateCourseAssignedDataAsync(instructorDto.CoursesAssigned, service); return(View($"{_viewFolder}Edit.cshtml", instructorDto)); }
public CoursesController(IInstructorService instructorService, ICourseService courseService, ICourseInstructorService courseInstructorService, ICategoryService categoryService) { _instructorService = instructorService; _courseService = courseService; _courseInstructorService = courseInstructorService; _categoryService = categoryService; }
public CourseOfferingsController(ICourseOfferingService courseOfferingService, ICourseService courseService, IRoomService roomService, IInstructorService instructorService) { _courseOfferingService = courseOfferingService; _courseService = courseService; _roomService = roomService; _instructorService = instructorService; }
public InstructorController(IMapper mapper, IInstructorService instructorService, IQuestionService questionService, UserManager <User> userManager) { _mapper = mapper; _instructorService = instructorService; _questionService = questionService; _userManager = userManager; }
public async Task <IActionResult> Create( InstructorAddEditDto instructorDto, [FromServices] IInstructorService service) { if (ModelState.IsValid) { try { await service.CreateInstructorAndSaveAsync(instructorDto); return(RedirectToAction(nameof(Index))); } catch (GeneralException ex) { ViewBag.HasError = true; ViewBag.Message = ex.Message; } catch (Exception ex) { _logger.LogError("Error in Create: " + ex.Message); ViewBag.HasError = true; ViewBag.Message = Constants.ERROR_MESSAGE_SAVE + ": " + ex.Message; } } await PopulateCourseAssignedDataAsync(instructorDto.CoursesAssigned, service); return(View($"{_viewFolder}Create.cshtml", instructorDto)); }
public async Task <IActionResult> DeleteConfirmed(int?id, [FromServices] IInstructorService service) { if (!id.HasValue) { return(NotFound()); } try { await service.DeleteInstructorAndSaveAsync(id.Value); TempData["Message"] = Constants.SUCCESS_MESSAGE; return(RedirectToAction(nameof(Index))); } catch (GeneralException ex) { TempData["Message"] = ex.Message; TempData["HasError"] = true; return(RedirectToAction(nameof(Delete), new { id = id.Value })); } catch (Exception ex) { TempData["Message"] = Constants.ERROR_MESSAGE_STANDARD + ": " + ex.Message; TempData["HasError"] = true; return(RedirectToAction(nameof(Delete), new { id = id.Value })); } }
public DepartmentController(IDepartmentService departmentService, IInstructorService instructorService) { //int x = 0; //int y = 1; //int z = y / x; _departmentService = departmentService; _instructorService = instructorService; }
public CourseController(IInstructorService instructorService, IDepartmentsService departmentsService, ICoursesService coursesService) { _instructorService = instructorService; _departmentsService = departmentsService; _coursesService = coursesService; }
public DepartmentsController(IDepartmentService departmentService, IInstructorService instructorService, IMapper mapper) { _departmentService = departmentService; _instructorService = instructorService; _mapper = mapper; }
public OfficeAssignmentsController(IOfficeAssignmentService officeAssignmentService, IInstructorService instructorService, IMapper mapper) { _officeAssignmentService = officeAssignmentService; _instructorService = instructorService; _mapper = mapper; }
public InstructorController( IAdminService adminService, IInstructorService instructorService, ApplicationDbContext context) { _adminService = adminService; _instructorService = instructorService; _context = context; }
public InstructorController(IInstructorService service, IUserService userService, ICoordinatorService coordinatorService, ICourseService courseService, IOwnerService ownerService, IStudentService studentService) { this._service = service; this.userService = userService; this.coordinatorService = coordinatorService; this.courseService = courseService; this.ownerService = ownerService; this.studentService = studentService; }
public AttendanceController(IAttendanceService service, IUserService userService, ICoordinatorService coordinatorService, IClassService classService, IStudentService studentService, IInstructorService instructorService) { this._service = service; this._userService = userService; this._coordinatorService = coordinatorService; this._classService = classService; this._studentService = studentService; this._instructorService = instructorService; }
public StudentController(IStudentService service, IUserService userService, IInstructorService InstructorService, ICoordinatorService coordinatorService, IOwnerService ownerService, ICourseService courseService) { this._service = service; this.userService = userService; this.InstructorService = InstructorService; this.CoordinatorService = coordinatorService; this.OwnerService = ownerService; this.CourseService = courseService; }
public ClassController(IClassService classService, ICourseService courseService, IUserService userService, IOwnerService ownerService, ICoordinatorService coordinatorService, IInstructorService instructorService) { this._classService = classService; this._courseService = courseService; this._userService = userService; this._ownerService = ownerService; this._coordinatorService = coordinatorService; this._instructorService = instructorService; }
public InstructorController(ISearchService searchService, IMapper <UserEntity, InstructorDTO> instructorMapper, IMapper <InstructorGroupEntity, GroupInstructorDTO> groupInstructorMapper, IInstructorService instructorService) { this.searchService = searchService; this.instructorMapper = instructorMapper; this.groupInstructorMapper = groupInstructorMapper; this.instructorService = instructorService; }
public AdminController( IDriverService driverService, ICategoryService categoryService, IMapper mapper, IInstructorService instructorService, UserManager <User> userManager, IResourceService resourceService) { _driverService = driverService; _categoryService = categoryService; _mapper = mapper; _instructorService = instructorService; _userManager = userManager; _resourceService = resourceService; }
public SubjectController(ISubjectService service, IUserService userService, IInstructorService instructorService, IStudentService studentService, ICoordinatorService coordinatorService, IClassService classService, ICourseService courseService, IOwnerService ownerService) { this._service = service; this._userService = userService; this._instructorService = instructorService; this._studentService = studentService; this._coordinatorService = coordinatorService; this._classService = classService; this._courseService = courseService; this._ownerService = ownerService; }
public InstructorController(IInstructorService instructorService, ICityService cityService, AppDbContext context, IStateService stateService, ILogger <InstructorController> logger, IMapper mapper) { _instructorService = instructorService; _context = context; _stateService = stateService; _logger = logger; _mapper = mapper; _cityService = cityService; }
// GET: Instructors/Details/5 public async Task <IActionResult> Details(int?id, [FromServices] IInstructorService service) { if (!id.HasValue) { return(NotFound()); } var instructor = await service.GetInstructorByIdForDetailAsync(id.Value); if (instructor == null) { return(NotFound()); } return(View($"{_viewFolder}Details.cshtml", instructor)); }
// GET: Instructors/Edit/5 public async Task <IActionResult> Edit(int?id, [FromServices] IInstructorService service) { if (!id.HasValue) { return(NotFound()); } var instructor = await service.GetInstructorByIdForEditAsync(id.Value); if (instructor == null) { return(NotFound()); } await PopulateCourseAssignedDataAsync(instructor.CoursesAssigned, service); return(View($"{_viewFolder}Edit.cshtml", instructor)); }
public void Init() { _mockInstructorList = new List <InstructorDto>() { new InstructorDto() { InstructorId = 1, InstructorName = "John Jacob", IsActive = true }, new InstructorDto() { InstructorId = 2, InstructorName = "Bruce Wayne", IsActive = true }, new InstructorDto() { InstructorId = 3, InstructorName = "Clark Kent", IsActive = true } }; _instructorService = Mock.Create <IInstructorService>(); }
public InstructorController(IInstructorService instructorService, IMapper mapper) { _instructorService = instructorService; _mapper = mapper; }
public OfficeAssignmentsController(IMapper mapper, IOfficeAssignmentService officeAssignmentService, IInstructorService instructorService) { this.officeAssignmentService = officeAssignmentService; this.instructorService = instructorService; this.mapper = mapper; }
public void SetService(IInstructorService instructorService) { _instructorService = instructorService; }