public async Task <IActionResult> Create(int?CategoryId, int?TagId) { if (User.IsInRole(Roles.Client) || !User.Identity.IsAuthenticated) { return(NotFound()); } ViewBag.SelectedCategories = new SelectList(await _blogCategoryService.GetAll(), "Id", "Title", CategoryId); ViewBag.SelectedTags = new SelectList(await _tagService.GetAll(), "Id", "Title", TagId); return(View()); }
public ActionResult Index() { HomeView view = new HomeView(); view.BlogCategories = _categoryService.GetAll().Categories; view.Tags = _tagService.GetAll(); view.NavView.SelectedMenuItem = "nav-blog"; view.Blogs = _blogService.GetAll().BlogList; return(View(view)); }
public ActionResult GetList() { var view = new HomeView(); view.NavView.SelectedMenuItem = "nav-blog"; var response = _blogService.GetAll(); view.Categories = _categoryService.GetAll().Categories; view.Posts = _blogService.GetLatestPosts(2); return(PartialView("BlogList", view)); }
public async Task <IActionResult> Index() { var controller = nameof(BlogCategoriesController).Split("Controller")[0]; var data = await _blogCategoryService.GetAll(); var html = "index"; if (User.IsInRole(Roles.Owner) || User.Identity.IsAuthenticated) { html = "manage"; } return(View($"~/Views/{controller}/{html}.cshtml", data)); }
public BlogCategoryDDL() { IBlogCategoryService _service = ObjectFactory.GetInstance <IBlogCategoryService>(); this.Items.Clear(); this.EmptyMessage = "-- Select --"; this.Items.Add(new RadComboBoxItem("", "0")); this.Skin = "Metro"; foreach (var s in _service.GetAll().Categories.OrderBy(o => o.Name)) { this.Items.Add(new RadComboBoxItem(s.Name, s.ID.ToString())); } }
public IActionResult DeleteConfirmedBlog(int blogId) { var entity = _blogService.GetById(blogId); var blogcategories = _blogcategoryService.GetAll().Where(i => i.BlogId == blogId).ToList(); if (entity != null) { if (blogcategories != null) { foreach (var item in blogcategories) { _blogcategoryService.Delete(item); } } _blogService.Delete(entity); } TempData.Put("message", new ResultMessage() { Title = "Bildirim", Message = "Blog başarıyla silindi.", Css = "success" }); return(RedirectToAction("Blog")); }
public async Task <IActionResult> Index(int id) { var model = new BlogDetailViewModel(); model.Blog = await _blogService.GetById(id); model.Blog.CountComment = (await _blogComment.FindAll()).Count(x => x.BlogId == id); model.Categories = await _blogCategoryService.GetAll(); model.PopularPosts = (from k in (await _blogService.GetAll()).OrderByDescending(x => x.DateModified).ToList() select new BlogViewModel { Image = k.Image, Id = k.Id, CountComment = 4, DateModified = k.DateModified, Description = k.Description, SeoAlias = k.SeoAlias }).Take(5); model.ReLateBlogs = (from b in (await _blogService.GetAll()).Where(x => x.BlogCategoryId == model.Blog.BlogCategoryId && x.Id != id).ToList() select new BlogViewModel { Image = b.Image, Id = b.Id, CountComment = 0, // CountComment =(await _blogComment.FindAll(y => y.BlogId == b.Id)).Count(), DateModified = b.DateModified, Description = b.Description, SeoAlias = b.SeoAlias }).Take(5); model.BlogTags = (await _blogTagRepository.FindAll()).Take(10); HttpContext.Session.Set(CommonConstants.BlogId, id); model.Tags = (await _blogTagRepository.FindAll(x => x.BlogId == id)).Select(x => x.TagId).ToList(); return(View(model)); }
public async Task <IViewComponentResult> InvokeAsync() { var menus = await _menuService.GetList(filter : "", group : (int)MenuGroup.top, status : Status.Active); var blogCategories = _blogCategoryService.GetAll(); var productCategories = _productCategoryService.GetAll(); foreach (var item in menus) { if (item.Type == (int)MenuType.Blog) { item.Target = blogCategories.SingleOrDefault(o => o.Id == item.Url.ToInt())?.SeoAlias; } else if (item.Type == (int)MenuType.Product) { item.Target = productCategories.SingleOrDefault(o => o.Id == item.Url.ToInt())?.SeoAlias; } else { item.Target = item.Url; } } return(View(menus)); }
public IActionResult GetAll() { var model = _blogCategoryService.GetAll(); return(new OkObjectResult(model)); }
public async Task <IActionResult> GetBlog() { var dataFromService = await _blogCategoryService.GetAll(); return(ResponseApi(new ApiResponse(dataFromService))); }
public async Task <IActionResult> GetAll() { var items = await _blogCategoryService.GetAll(); return(new OkObjectResult(items)); }
public IEnumerable <BlogCategory> GetBlogCategories() { return(service.GetAll()); }
public IActionResult Index() { var categories = _blogCategoryService.GetAll(); return(View(categories)); }