コード例 #1
0
        public ActionResult Index()
        {
            var user        = _user;
            var isUserValid = _authService.IsUserValid(user);
            var authroizationLevelRequired = 1;

            if (isUserValid)
            {
                var isUserAuthorized = _authService.isUserAuthorized(user, authroizationLevelRequired);
                if (isUserAuthorized)
                {
                    var            clientSiteDTO   = _service.CreateClientSiteDTOs();
                    var            locationDTO     = _service.CreateLocationDTOs();
                    var            assetDTO        = _service.CreateAssetDTO();
                    var            productDTO      = _service.CreateProductDTOs();
                    var            manufacturerDTO = _service.CreateManufacturerDTOs();
                    var            modelDTO        = _service.CreateModelDTOs();
                    AssetViewModel model           = new AssetViewModel(clientSiteDTO, locationDTO, assetDTO, productDTO, manufacturerDTO, modelDTO);
                    return(View(model));
                }
                else
                {
                    return(RedirectToAction("Index", "UnauthorizedAccess"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "UnauthorizedAccess"));
            }
        }