//
        // GET: /Instructor/Details/5

        public ActionResult Details(int id = 0)
        {
            ViewBag.menu = MENU;
            Instructor instructor = repository.GetByID(id);

            if (instructor == null)
            {
                return(HttpNotFound());
            }

            return(View(instructor));
        }
Beispiel #2
0
        public async Task <DataResponse <Instructor> > GetByID(int id)
        {
            try
            {
                DataResponse <Instructor> response = await _InstructorRepo.GetByID(id);

                return(response);
            }
            catch (Exception e)
            {
                StringBuilder sb = new StringBuilder();
                log.Error(sb.AppendLine(e.Message).AppendLine(e.StackTrace).ToString());
                DataResponse <Instructor> r = new DataResponse <Instructor>()
                {
                    Success = false
                };
                r.ErrorList.Add("Error on get Instructor");
                return(r);
            }
        }
        public ActionResult Details(int id = 0)
        {
            Instructor instructor = repository.GetByID(id);
            var        model      = new
            {
                FirstMidName     = instructor.FirstMidName,
                FullName         = instructor.FullName,
                HireDate         = instructor.HireDate,
                LastName         = instructor.LastName,
                OfficeAssignment = new { Location = instructor.OfficeAssignment == null ? null : instructor.OfficeAssignment.Location },
                PersonID         = instructor.PersonID
            };

            Dictionary <string, object> res = new Dictionary <string, object>
            {
                { "model", model }
            };

            return(Json(res, JsonRequestBehavior.AllowGet));
        }