Skip to content

Conversation

Copy link

Copilot AI commented Sep 22, 2025

  • Analyzed existing codebase structure
  • Identified Store area structure with controllers and views
  • Reviewed existing Admin Blog functionality
  • Created BlogController for Store area
  • Added Blog management views to Store area (List, Create, Edit, Preview)
  • Created required partials and templates for Blog management
  • Verified routing and navigation configuration
  • Confirmed integration with existing menu system
  • Removed store restrictions from Admin BlogController per feedback
  • Fixed missing using directive for BlogPostModel in Store _ViewImports.cshtml
  • Fixed GetAllBlogPosts method call parameter mismatch

Latest Fix:

Corrected the GetAllBlogPosts method call in the Store BlogController's List action. The issue was that the method was being called with incorrect positional parameters, causing a type mismatch where a string was being passed for a DateTime? parameter.

Changed from:

var blogPosts = await _blogService.GetAllBlogPosts(storeId, "", command.Page - 1, command.PageSize);

To:

var blogPosts = await _blogService.GetAllBlogPosts(storeId, 
    pageIndex: command.Page - 1, pageSize: command.PageSize);

This uses named parameters to explicitly specify pageIndex and pageSize, avoiding the type conversion error and ensuring the correct method overload is used.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add Blog management functionality to Store area Add Blog management functionality to Store area Sep 22, 2025
@KrzysztofPajak
Copy link
Member

@copilot Verify the controller in the admin panel and remove the restriction related to the store, because it has been moved to the store project.

Copy link
Author

Copilot AI commented Sep 22, 2025

@copilot Verify the controller in the admin panel and remove the restriction related to the store, because it has been moved to the store project.

I've removed all store restrictions from the Admin BlogController as requested. The changes include removing IsStoreManager checks, StaffStoreId assignments, and AccessToEntityByStore validations across all blog post and category management methods. The Admin area now has full access to all blog content while store-specific management remains in the Store area. Changes committed in 9664d85.

Copilot AI changed the title Add Blog management functionality to Store area Add Blog management functionality to Store area and remove Admin store restrictions Sep 22, 2025
@KrzysztofPajak
Copy link
Member

@copilot Add missing using in _ViewImports.cshtml
because there is a issue in src/Web/Grand.Web.Store/Areas/Store/Views/Blog/Partials/CreateOrUpdate.TabSeo.cshtml(2,8): Error CS0246: The type or namespace name 'BlogPostModel' could not be found (are you missing a using directive or an assembly reference?)

Copy link
Author

Copilot AI commented Sep 23, 2025

@copilot Add missing using in _ViewImports.cshtml
because there is a issue in src/Web/Grand.Web.Store/Areas/Store/Views/Blog/Partials/CreateOrUpdate.TabSeo.cshtml(2,8): Error CS0246: The type or name...

I've added the missing @using Grand.Web.AdminShared.Models.Blogs directive to the Store area's _ViewImports.cshtml file. This resolves the CS0246 compilation error where BlogPostModel could not be found in the CreateOrUpdate.TabSeo.cshtml file. The fix allows all Blog views in the Store area to properly reference Blog models. Changes committed in fede02c.

@KrzysztofPajak
Copy link
Member

@copilot issue
src/Web/Grand.Web.Store/Controllers/BlogController.cs(76,69): Error CS1503: Argument 2: cannot convert from 'string' to 'System.DateTime?'

Copy link
Author

Copilot AI commented Sep 23, 2025

@copilot issue
src/Web/Grand.Web.Store/Controllers/BlogController.cs(76,69): Error CS1503: Argument 2: cannot convert from 'string' to 'System.DateTime?'

I've fixed the parameter mismatch in the GetAllBlogPosts method call. The issue was that I was passing an empty string "" as the second positional parameter, which was being interpreted as dateFrom (DateTime?) instead of blogPostName (string). I've updated the call to use named parameters: pageIndex: command.Page - 1, pageSize: command.PageSize which resolves the CS1503 compilation error. Changes committed in c7480d1.

Updated the `Create` method to await the asynchronous call
to `_blogService.GetBlogPostById(id)`. Removed redundant
initialization of the `AllowComments` property in
`BlogPostModel`.
@KrzysztofPajak KrzysztofPajak marked this pull request as ready for review September 29, 2025 17:23
@sonarqubecloud
Copy link

@KrzysztofPajak KrzysztofPajak merged commit 4749fb6 into develop Sep 30, 2025
6 checks passed
@KrzysztofPajak KrzysztofPajak deleted the copilot/fix-7efbd1e9-6f1f-4b61-8891-2bd3b9c3e972 branch September 30, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants