public async Task <IActionResult> Index()
        {
            var controller = nameof(FeatureAttributesController).Split("Controller")[0];
            var data       = await _featureAttributeService.GetAll();

            var html = "index";

            if (User.IsInRole(Roles.Owner) || User.Identity.IsAuthenticated)
            {
                html = "manage";
            }
            return(View($"~/Views/{controller}/{html}.cshtml", data));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddProductAttribute(int?productId)
        {
            if (productId == null)
            {
                return(NotFound());
            }
            if (User.IsInRole(Roles.Client) || !User.Identity.IsAuthenticated)
            {
                return(NotFound());
            }

            var model = await _productService.Get(productId);

            var vm = new ProductAttribute
            {
                ProductsId = model.Id,
            };

            ViewBag.Categories = new SelectList((await _shopCategoryService.GetAll()).ToList(), "Id", "Title");
            ViewBag.Features   = new SelectList((await _featureService.GetAll()).ToList(), "Id", "Title");
            ViewBag.Attributes = new SelectList((await _featureAttributeService.GetAll()).ToList(), "Id", "Title");
            return(View(vm));
        }