コード例 #1
0
        // [Route("/ErrorRegister")]
        // GET: ErrorRegister
        public ActionResult Index()
        {
            var userId = User.Identity.Name;

            //var loggedInUser = _appUserService.GetAppUser(t => t.Id == userId).FirstOrDefault();

            var _returnRegisters = _errorRegister.AllErrorRegisters();
            var _companyList     = _company.AllCompanies();
            var _departmentList  = _department.AllDepartments();
            var _riskList        = _riskType.AllRiskTypes();

            var query = from errors in _returnRegisters
                        join companylist in _companyList on errors.CompanyId equals companylist.Id
                        join departmentlist in _departmentList on errors.DepartmentId equals departmentlist.Id
                        join risklist in _riskList on errors.RiskTypeId equals risklist.Id
                        select new ErrorRegisterVM
            {
                Id          = errors.Id,
                DateCreated = errors.DateCreated,
                ErrorType   = errors.ErrorType,
                Narration   = errors.Narration,
                Officer     = errors.Officer,
                Status      = errors.Status,
                ErrorStatus = errors.ErrorStatus,
                Remark      = errors.Remark,
                RiskType    = risklist.Name,
                Company     = companylist.Name,
                Department  = departmentlist.Name,
                DateUpdated = errors.DateUpdated,
                UpdatedBy   = userId
            };

            return(View(query));
        }
コード例 #2
0
        public ActionResult Create()
        {
            List <Company>    companyList    = new List <Company>();
            List <Department> departmentlist = new List <Department>();
            List <RiskType>   riskTypeList   = new List <RiskType>();

            companyList = _company.AllCompanies().ToList();
            companyList.Insert(0, new Company {
                Id = 0, Name = "Select"
            });

            departmentlist = _department.AllDepartments().ToList();
            departmentlist.Insert(0, new Department {
                Id = 0, Name = "Select"
            });

            riskTypeList = _riskType.AllRiskTypes().ToList();
            riskTypeList.Insert(0, new RiskType {
                Id = 0, Name = "Select"
            });

            ViewBag.CompanyDetails    = companyList;
            ViewBag.DepartmentDetails = departmentlist;
            ViewBag.RiskTypeDetails   = riskTypeList;



            return(View());
        }
コード例 #3
0
        public IActionResult Entry()
        {
            // view bag values for the front end
            ViewBag.CompanyCount    = _company.AllCompanies().Count();
            ViewBag.DepartmentCount = _department.AllDepartments().Count();
            ViewBag.RiskTypeCount   = _riskType.AllRiskTypes().Count();
            ViewBag.RegisteredRisks = _registerRisk.AllRiskRegisters().Count();

            return(View());
        }