Exemplo n.º 1
0
        //
        // 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));
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 3
0
        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));
        }