public int InsertSlug(PostModel post, int categoryId, int argumentId) { int slugId = 0; if (argumentId == 0) { slugId = _categoryService.GetById(categoryId).slugId; } else { slugId = _argumentService.GetById(argumentId).slugId; } var categoryArgumentSlug = _slugService.GetById(slugId).name; var name = string.Concat(categoryArgumentSlug, _commonService.cleanStringPath(post.title), '/'); var model = new SlugModel(); model.name = name; model.entityname = "Post"; _slugService.Insert(model); return(_slugService.GetByName(name).id); }
public int InsertSlug(ArgumentModel argument, int categoryId) { var categorySlugId = _categoryService.GetById(categoryId).slugId; var categorySlug = _slugService.GetById(categorySlugId).name; var name = ""; if (argument.idPadre > 0) { var idPadre = _argumentService.GetById(argument.idPadre).id; var nomePadre = _argumentService.GetById(idPadre).name; name = string.Concat(categorySlug, nomePadre, '/', _commonService.cleanStringPath(argument.name), '/'); } else { name = string.Concat(categorySlug, _commonService.cleanStringPath(argument.name), '/'); } var model = new SlugModel(); model.name = name; model.entityname = "Argument"; _slugService.Insert(model); return(_slugService.GetByName(name).id); }
public int InsertSlug(CategoryModel category) { var name = string.Concat("/Blog", '/', _commonService.cleanStringPath(category.name), '/'); var model = new SlugModel(); model.name = name; model.entityname = "Category"; _slugService.Insert(model); return(_slugService.GetByName(name).id); }
public static List <SlugModel> ListPages() { var slug1 = new SlugModel { Name = "kevin", Description = "Kevin likez the Bruins" }; var slug2 = new SlugModel { Name = "bill", Description = "Bill is a nerd" }; var slug3 = new SlugModel { Name = "timothy", Description = "T.J. likes anime" }; var slugList = new List <SlugModel> { slug1, slug2, slug3 }; return(slugList); }