public IActionResult GetAll() { var arguments = _argumentService.GetAll(); var argumentsDto = _mapper.Map <IList <ArgumentDto> >(arguments); return(Ok(argumentsDto)); }
public IActionResult All(int pageSize, int pageNumber) { var model = new ArgumentModel(); //SEO ViewBag.description = "Categorie disponibili"; //List var excludeRecords = (pageSize * pageNumber) - pageSize; var total = _argumentService.GetAll().Count; model.sectionName = "Lista Categorie"; model.pageSize = pageSize; model.pageTotal = Math.Ceiling((double)total / pageSize); model.arguments = _argumentService.GetAll(); foreach (var argument in model.arguments) { model.argumentsDisplay.Add(new ArgumentDisplay() { id = argument.id, slug = _slugService.GetById(argument.slugId).name, coverImage = _photoService.GetById(argument.coverImageId).path, title = argument.name, descrizione = argument.description.Length > 200 ? argument.description.Substring(0, 200) : argument.description }); } return(View(model)); }
public IList <PostsPath> GetAllPath() { var models = new List <PostsPath>(); var categories = _categoryService.GetAll(); foreach (var category in categories) { models.Add(new PostsPath() { categoryId = category.id, name = category.name }); } ; var arguments = _argumentService.GetAll(); foreach (var argument in arguments) { models.Add(new PostsPath() { categoryId = argument.category.id, argumentId = argument.id, name = argument.category.name + " / " + argument.name, }); } ; return(models.OrderBy(p => p.name).ToList()); }
public ArgumentModel GetAll(int pageSize, int pageNumber) { var model = new ArgumentModel(); var excludeRecords = (pageSize * pageNumber) - pageSize; var total = _argumentService.GetAll().Count; model.sectionName = "Argomenti"; model.pageSize = pageSize; model.pageTotal = Math.Ceiling((double)total / pageSize); model.arguments = _argumentService.GetAll(excludeRecords, pageSize); model.posts = _postService.GetAllByCategoryId(model.categoryId); if (model.pageTotal > 1) { model.displayPagination = true; } else { model.displayPagination = false; } return(model); }