// GET: Instructor
        public ActionResult Index()
        {
            var courses = _service.GetAllInstructors();

            ViewBag.Title = "List All Instructors";
            return(View("List", courses));
        }
示例#2
0
        public HttpResponseMessage GetAllInstructors()
        {
            var Instructors = _Instructorservice.GetAllInstructors();

            if (Instructors.Any())
            {
                return(Request.CreateResponse(HttpStatusCode.OK, Instructors));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, "No Instructors found."));
            }
        }
        public async Task <IHttpActionResult> Get()
        {
            var instructorsOut = await _instructorService.GetAllInstructors();

            return(new Helpers.ActionResultBuilder
                   .CreateActionResult <IEnumerable <InstructorOut> >(Request, instructorsOut, System.Net.HttpStatusCode.OK));
        }
        // GET: Instructors
        public ActionResult Index()
        {
            var instructors = _instructorService.GetAllInstructors();
            var model       = Mapper.Map <IEnumerable <Instructor>, List <PersonViewModel> >(instructors);

            return(View(model));
        }
示例#5
0
        public HttpResponseMessage GetAllInstructors(int?page)
        {
            var pageNumber = (page ?? 1) - 1;
            var totalCount = 0;
            var PageSize   = 10;
            var students   = _instructorService.GetAllInstructors(page, PageSize, out totalCount);

            var enumerable = students as IList <Instructor> ?? students.ToList();
            var response   = enumerable.Any()
                ? Request.CreateResponse(HttpStatusCode.OK, enumerable)
                : Request.CreateResponse(HttpStatusCode.NotFound, "No Instructors Found");

            return(response);
        }
示例#6
0
        // GET: Department/Create
        //public ActionResult Create() {

        //    return View();
        //}

        public ActionResult Create()
        {
            // prepare the instructorlist for view display
            InstructorSelectList inslist = new InstructorSelectList()
            {
                _instructors = _instructorService.GetAllInstructors()
            };
            DeptWithInsListViewModel depwithInsList = new DeptWithInsListViewModel()
            {
                InsList = inslist
            };

            return(View(depwithInsList));
        }
示例#7
0
        // GET: Department/Create
        public ActionResult Create()
        {
            var instructors = _instructorService.GetAllInstructors()
                              .Select(n => new SelectListItem
            {
                Text = n.FullName, Value = n.Id.ToString()
            }).ToList();

            instructors.Insert(0,
                               new SelectListItem {
                Value = null, Text = @"--- select Instructor ---"
            });

            var departmentCreate = new CreateDepartmentViewModel
            {
                Instructors = instructors
            };


            return(View(departmentCreate));
        }
示例#8
0
        public ActionResult Create()
        {
            var instructors = _instructorService.GetAllInstructors().Select(n => new SelectListItem
            {
                Text  = n.FirstName + " " + n.LastName,
                Value = n.Id.ToString()
            }).ToList();

            instructors.Insert(0,
                               new SelectListItem
            {
                Value = null,
                Text  = @"--- select Instructor ---"
            });
            // this departmentCreate variable only contains instructor data, all other properties are null
            // thus we need to pass those properties to this variable
            var departmentCreate = new CreateDepartmentViewModel
            {
                Instructors = instructors
            };

            return(View(departmentCreate));
        }
        public ActionResult LazyIndex()
        {
            var all = _service.GetAllInstructors();

            return(View("Index", all));
        }
示例#10
0
 // GET: Instructor
 public ActionResult Index()
 {
     return(View(instructorService.GetAllInstructors()));
 }
        public ActionResult Index()
        {
            var instructors = instructorService.GetAllInstructors();

            return(View(instructors));
        }
        public async Task <IHttpActionResult> Get()
        {
            var instructorsOut = await _instructorService.GetAllInstructors();

            return(Ok(instructorsOut));
        }