Пример #1
0
        public ViewResult Details(int?id)

        {
            //throw new Exception("Error in Details View");

            logger.LogTrace("Trace Log");
            logger.LogDebug("Debug Log");
            logger.LogInformation("Information Log");
            logger.LogWarning("Warning Log");
            logger.LogError("Error Log");
            logger.LogCritical("Critical Log");



            Employee employee = _employeeRepository.GetEmployee(id.Value);

            if (employee == null)

            {
                Response.StatusCode = 404;
                return(View("EmployeeNotFound", id.Value));
            }
            HomeDetailsViewModel homeDetailsViewModel = new HomeDetailsViewModel()
            {
                //Employee = _employeeRepository.GetEmployee(id),
                //Employee = _employeeRepository.GetEmployee(1),
                //Employee = _employeeRepository.GetEmployee(id ?? 1),
                Employee  = employee,
                PageTitle = "Employee Details"
            };

            return(View(homeDetailsViewModel));
        }
        public ViewResult Details(int?id)
        {
            Employee employee = _employeeRpository.GetEmployee(id.Value);

            if (employee == null)
            {
                Response.StatusCode = 404;
                return(View("EmployeeNotFound", id.Value));
            }
            HomeDetailsViewModel homeDetailsViewModel = new HomeDetailsViewModel
            {
                Employee  = employee,// _employeeRpository.GetEmployee(id ?? 1),
                PageTitle = "Employee Details"
            };

            //return new ObjectResult(employee);
            //return Json(employee);
            return(View(homeDetailsViewModel));
        }