Exemplo n.º 1
0
        public IActionResult List(string categoryName)
        {
            var model = new CategoryListViewModel
            {
                Categories = _categoryService.GetByName(categoryName)
            };

            return(View(model));
        }
        public IActionResult Index()
        {
            CategoryListViewModel categoryListViewModel = new CategoryListViewModel()
            {
                Categories = _categoryServices.GetAll()
            };

            return(View(categoryListViewModel));
        }
        public ActionResult Index()
        {
            var model = new CategoryListViewModel
            {
                Categories = _categoryManager.GetAll()
            };

            return(View(model));
        }
 public ViewViewComponentResult Invoke()
 {
     CategoryListViewModel model = new CategoryListViewModel
     {
         Categories = _categoryService.GetAll(),
         CurrentCategory = Convert.ToInt32(HttpContext.Request.Query["categoryId"])
     };
     return View(model);
 }
        public ViewViewComponentResult Invoke()
        {
            var model = new CategoryListViewModel
            {
                Categories = _categoryDal.GetList()
            };

            return(View(model));
        }
Exemplo n.º 6
0
 private void RemoveCategory_Click(object sender, RoutedEventArgs e)
 {
     if (sender is Button button && button.DataContext is Category category)
     {
         CategoryListViewModel vm = DataContext as CategoryListViewModel;
         App.AvailableCategories.Remove(category);
         vm.ForceUpdateList();
     }
 }
Exemplo n.º 7
0
        public async Task <IActionResult> Index(string name = GlobalConstants.CoffeeName)
        {
            var viewModel = new CategoryListViewModel
            {
                Categories = await this.categoryService.GetAllByNameAsync <CategoryInListViewModel>(name),
            };

            return(this.View(viewModel));
        }
Exemplo n.º 8
0
 public IActionResult AddCategory(CategoryListViewModel model)
 {
     if (ModelState.IsValid)
     {
         categoryRepository.Create(model.Category);
         return(RedirectToAction("Category"));
     }
     return(RedirectToAction("Category"));
 }
Exemplo n.º 9
0
        public ViewResult List()
        {
            CategoryListViewModel model = new CategoryListViewModel
            {
                Categories = unitOfWork.CategoryRepository.Get(null, x => x.OrderBy(o => o.Id)).Distinct()
            };

            return(View(model));
        }
Exemplo n.º 10
0
        public ActionResult Categories()
        {
            CategoryListViewModel model = new CategoryListViewModel
            {
                Categories = _categoryService.GetAll()
            };

            return(View(model));
        }
Exemplo n.º 11
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var viewModel = new CategoryListViewModel
            {
                Categories = await this.categoryService.GetAllAsync <CategoryInListViewModel>(),
            };

            return(this.View(viewModel));
        }
Exemplo n.º 12
0
        public ViewViewComponentResult Invoke()
        {
            CategoryListViewModel model = new CategoryListViewModel()
            {
                Categories    = _categoryService.GetAllCategories(),
                SubCategories = _subCategoryService.GetAll(),
            };

            return(View(model));
        }
        public IViewComponentResult Invoke()
        {
            var model = new CategoryListViewModel()
            {
                SelectedCategory = RouteData.Values["category"]?.ToString(),//? dememin sebebi category null değilse  string e çevirecek. Null ise stringe çevirmeye gerek kalmayacak. ? yazmazsak olmayan kategory i string e çevirmeye çalışacak ve hata verir
                Categories       = _categoryService.GetAll()
            };

            return(View(model));
        }
Exemplo n.º 14
0
 public IActionResult DeleteCategory(CategoryListViewModel model)
 {
     if (ModelState.IsValid)
     {
         categoryRepository.Delete(model.Category);
         return(RedirectToAction("Category"));
     }
     ModelState.AddModelError("", "Error");
     return(RedirectToAction("Category"));
 }
Exemplo n.º 15
0
        private CategoryListViewModel GetCategoryListFromCategoryManager(string category)
        {
            var entries = !string.IsNullOrEmpty(category)
                                ? categoryManager.GetEntries(category, httpContextAccessor.HttpContext.Request.Headers["Accept-Language"])
                                : categoryManager.GetEntries();

            var viewModel = CategoryListViewModel.Create(entries);

            return(viewModel);
        }
        public ViewViewComponentResult Invoke()
        {
            var items = _categoryService.GetAll();
            var model = new CategoryListViewModel()
            {
                Categories = items
            };

            return(View(model));
        }
        public async Task <IActionResult> List([FromQuery] QueryParams queryParams)
        {
            var viewModel = new CategoryListViewModel
            {
                Categories = await _categoryService.GetPagedCategoriesAsync(queryParams),
                q          = queryParams.q
            };

            return(View(viewModel));
        }
        public PartialViewResult CategoryList()
        {
            CategoryListViewModel model = new CategoryListViewModel
            {
                CurrentCategory = Convert.ToInt32(Session["category"]),
                Categories      = _CategoryService.GetAll(0)
            };

            return(PartialView(model));
        }
Exemplo n.º 19
0
        public IViewComponentResult Invoke()
        {
            var viewModel = new CategoryListViewModel
            {
                CategoryNames =
                    this.categoriesService.GetAllProductCategories <CategoryViewModel>(),
            };

            return(this.View(viewModel));
        }
Exemplo n.º 20
0
        public ViewViewComponentResult Invoke()
        {
            var model = new CategoryListViewModel
            {
                Categories      = _categoryService.GetAll().OrderBy(c => c.Name).ToList(),
                CurrentCategory = Convert.ToInt32(HttpContext.Request.Query["category"])
            };

            return(View(model));
        }
        public IViewComponentResult Invoke()
        {
            CategoryListViewModel model = new CategoryListViewModel()
            {
                Categories       = _categoryService.GetAll(),
                SelectedCategory = RouteData.Values["category"]?.ToString()
            };

            return(View(model));
        }
        public ViewViewComponentResult Invoke()  //uyandırmak gibi anlmaı var
        {
            var model = new CategoryListViewModel
            {
                Categories      = _categoryService.GetAll(),
                CurrentCategory = Convert.ToInt32(HttpContext.Request.Query["category"])
            };

            return(View(model));
        }
Exemplo n.º 23
0
        public IViewComponentResult Invoke()
        {
            var model = new CategoryListViewModel()
            {
                Categories      = _categoryService.GetList(),
                CurrentCategory = Convert.ToInt32(HttpContext.Request.Query["category"])
            };

            return(View(model));
        }
Exemplo n.º 24
0
        public ViewViewComponentResult Invoke()
        {
            var model = new CategoryListViewModel()
            {
                Categories     = _categoryService.GetAll(),
                CurrenCategory = Convert.ToInt32(HttpContext.Request.Query["category"])
            };

            return(View("/Views/Components/CategoryList/Default.cshtml", model));
        }
Exemplo n.º 25
0
        public ViewViewComponentResult Invoke()
        {
            CategoryListViewModel model = new CategoryListViewModel
            {
                Categories      = _repo.GetAll().ToList(),
                CurrentCategory = Convert.ToInt32(HttpContext.Request.Query["search"])
            };

            return(View(model));
        }
Exemplo n.º 26
0
        public UIElement GetListView()
        {
            CategoryListViewModel viewModel = new CategoryListViewModel(factory, this);
            CategoryListView      view      = new CategoryListView(viewModel);
            Window window = WindowFactory.CreateByContentsSize(view);

            viewModel.CategorySelected += (s, e) => OnSelect(e.Data);

            return(view);
        }
//<<<<<<< HEAD
//        // GET: dashboardCategory
//        [AuthorizeMaster]
//        public ActionResult Index()
//=======
//        // GET: dashboardCategory'

//        //public ActionResult Index()
//        //{
//        //    return View();
//        //}
//        //[HttpPost]
        public ActionResult Index(/*CategoryViewModel input*/)

        {
            CategoryService       cs     = new CategoryService();
            CategoryListViewModel result = cs.GetAllCategory();

            //SubCategoryViewModel results = cs.AddSubCategory();

            return(View(result));
        }
Exemplo n.º 28
0
        public ViewViewComponentResult Invoke()
        {
            var model = new CategoryListViewModel
            {
                //Kategori listemizi partial kullanmak istediğimizi varsayalım.
                Categories = _categoryRepository.GetAll().ToList()
            };

            return(View(model));
        }
        public ViewViewComponentResult Invoke()
        {
            var model = new CategoryListViewModel
            {
                Categories      = _categoryService.GetAll(),
                CurrentCategory = Convert.ToInt32(HttpContext.Request.Query["category"]) //tıkladığım category belli olsun diye
            };

            return(View(model));
        }
Exemplo n.º 30
0
        public IActionResult CategoryList()
        {
            var categories            = _categoryService.GetAll();
            var categoryListViewModel = new CategoryListViewModel()
            {
                Categories = categories
            };

            return(View(categoryListViewModel));
        }
        public void Loaded_PropertiesSet()
        {
            var categoryRepoSetup = new Mock<ICategoryRepository>();
            categoryRepoSetup.Setup(x => x.GetList(null)).Returns(() => new List<CategoryViewModel>
            {
                new CategoryViewModel {Name = string.Empty}
            });

            var vm = new CategoryListViewModel(categoryRepoSetup.Object, new Mock<IModifyDialogService>().Object, new Mock<IDialogService>().Object);
            vm.LoadedCommand.Execute();

            vm.Source.ShouldNotBeNull();
        }
Exemplo n.º 32
0
        public PartialViewResult ListMainCategories()
        {
            using (UnitOfWorkManager.NewUnitOfWork())
            {

                var catViewModel = new CategoryListViewModel
                {
                    AllPermissionSets = ViewModelMapping.GetPermissionsForCategories(_categoryService.GetAllMainCategories(), _roleService, UsersRole)
                };
                return PartialView(catViewModel);
            }
        }
Exemplo n.º 33
0
        public ActionResult Show(string slug, int? p)
        {
            using (UnitOfWorkManager.NewUnitOfWork())
            {
                // Get the category
                var category = _categoryService.GetBySlugWithSubCategories(slug);

                // Allowed Categories for this user
                var allowedCategories = _categoryService.GetAllowedCategories(UsersRole);

                // Set the page index
                var pageIndex = p ?? 1;

                // check the user has permission to this category
                var permissions = RoleService.GetPermissions(category.Category, UsersRole);

                if (!permissions[SiteConstants.Instance.PermissionDenyAccess].IsTicked)
                {

                    var topics = _topicService.GetPagedTopicsByCategory(pageIndex,
                                                                        SettingsService.GetSettings().TopicsPerPage,
                                                                        int.MaxValue, category.Category.Id);

                    var topicViewModels = ViewModelMapping.CreateTopicViewModels(topics.ToList(), RoleService, UsersRole, LoggedOnReadOnlyUser, allowedCategories, SettingsService.GetSettings());

                    // Create the main view model for the category
                    var viewModel = new CategoryViewModel
                        {
                            Permissions = permissions,
                            Topics = topicViewModels,
                            Category = category.Category,
                            PageIndex = pageIndex,
                            TotalCount = topics.TotalCount,
                            TotalPages = topics.TotalPages,
                            User = LoggedOnReadOnlyUser,
                            IsSubscribed = UserIsAuthenticated && (_categoryNotificationService.GetByUserAndCategory(LoggedOnReadOnlyUser, category.Category).Any())
                        };

                    // If there are subcategories then add then with their permissions
                    if (category.SubCategories.Any())
                    {
                        var subCatViewModel = new CategoryListViewModel
                            {
                                AllPermissionSets = new Dictionary<Category, PermissionSet>()
                            };
                        foreach (var subCategory in category.SubCategories)
                        {
                            var permissionSet = RoleService.GetPermissions(subCategory, UsersRole);
                            subCatViewModel.AllPermissionSets.Add(subCategory, permissionSet);
                        }
                        viewModel.SubCategories = subCatViewModel;
                    }

                    return View(viewModel);
                }

                return ErrorToHomePage(LocalizationService.GetResourceString("Errors.NoPermission"));
            }
        }