public IActionResult AddCourse() { ViewData["departments"] = _departmentsService .GetAllDepartmentsService(); ViewData["instructors"] = _instructorService .GetInstructors(); return(View()); }
public IHttpActionResult GetInstructors() { var instructors = instructorService.GetInstructors(); var instructorsDTO = instructors.Select(instructorMapper.Map).ToList(); return(Ok(instructorsDTO)); }
public IActionResult GetInstructors() { try { var instructorList = _instructorService.GetInstructors(); var result = _mapper.Map <List <Instructor>, List <InstructorDTO> >(instructorList); return(Ok(result)); } catch (Exception) { return(BadRequest("Error!")); } }
private object GetDatabaseData() { int total = 0; int totalFiltered = 0; var records = _instructorService.GetInstructors(); return(new { recordsTotal = total, recordsFiltered = totalFiltered, data = (from record in records select new string[] { record.Id.ToString(), record.Name, record.DepartmentId.ToString(), record.Salary.ToString() } ).ToArray() }); }