public IHttpActionResult GetAllInstructors() { var svc = new InstructorService(); var instructors = svc.GetAllInstructors(); return(Ok(instructors)); }
// GET: Instructor public ActionResult Index() { ContosoContext cc = new ContosoContext(); InstructorRepository ir = new InstructorRepository(cc); InstructorService instructorService = new InstructorService(ir); var instructor = instructorService.GetAllInstructors(); return(View(instructor)); }
public async Task <IActionResult> Index(int?id, int?courseId) { var viewModel = new InstructorViewModel { Instructors = await _instructorService.GetAllInstructors() }; if (id != null) { ViewData["InstructorId"] = id.Value; var instructor = viewModel.Instructors.Single(i => i.InstructorId == id.Value); viewModel.Courses = instructor.Courses; } if (courseId != null) { ViewData["CourseId"] = courseId.Value; var selectedCourse = viewModel.Courses.Single(x => x.Id == courseId); viewModel.Enrollments = selectedCourse.Enrollments; } return(View(viewModel)); }
protected void Page_Load(object sender, EventArgs e) { DataBindingHelper.PopulateActiveBranches(BranchService, ddlBranch, User.Identity.Name, false); ddlBranch.SelectedValue = Convert.ToString(HomeBranchID); ddlMonth.DataSource = CommonHelper.GetMonthNames(); ddlMonth.DataTextField = "Value"; ddlMonth.DataValueField = "Key"; ddlMonth.DataBind(); ddlMonth.SelectedValue = DateTime.Today.Month.ToString(); for (int year = DateTime.Today.Year - 3; year <= DateTime.Today.Year; year++) { ddlYear.Items.Add(new DropDownListItem(year.ToString(CultureInfo.InvariantCulture))); } ddlYear.FindItemByText(DateTime.Today.Year.ToString(CultureInfo.InvariantCulture)).Selected = true; ddlInstructor.DataSource = InstructorService.GetAllInstructors(); ddlInstructor.DataValueField = "ID"; ddlInstructor.DataTextField = "Name"; ddlInstructor.DataBind(); }
public async Task <IActionResult> Get() { return(Ok(await _instructorService.GetAllInstructors())); }