예제 #1
0
        public async Task <IActionResult> OnGetAsync(string cat, string type, int?p)
        {
            CatalogTypeModel = await _catalogService.GetCatalogTypeItemsAsync(cat, type, p ?? 0, Constants.ITEMS_PER_PAGE, HttpContext.Request.Query["oa"]);

            if (CatalogTypeModel == null)
            {
                return(RedirectToPage("/Category/Index", new { id = cat }));
            }
            MetaDescription = CatalogTypeModel.MetaDescription;
            Title           = CatalogTypeModel.Title;

            return(Page());
        }
        public IActionResult ChangeTypeName(int id, int categoryId)
        {
            var type = _categoryRepository.GetTypeById(id);

            if (type == null)
            {
                return(NotFound());
            }
            CatalogTypeViewModel model = new CatalogTypeViewModel {
                Id = type.Id, Type = type.Type, categoryId = categoryId
            };

            return(View(model));
        }
 public IActionResult CreateType(CatalogTypeViewModel model)
 {
     _categoryRepository.EditCategory(model.categoryId, model.Type);
     return(RedirectToAction("GetItems"));
 }
 public IActionResult ChangeTypeName(CatalogTypeViewModel model)
 {
     _categoryRepository.ChangeNameType(model.categoryId, model.Id, model.Type);
     return(RedirectToAction("GetById", new { model.categoryId }));
 }