Skip to content

Conversation

devin-ai-integration[bot]
Copy link

@devin-ai-integration devin-ai-integration bot commented Jul 2, 2025

Migrate ASP.NET MVC 5 to ASP.NET Core 7 Web API

Summary

This PR migrates the existing ASP.NET MVC 5 (.NET Framework 4.8) application to ASP.NET Core 7 Web API while preserving the AngularJS frontend functionality. The migration creates a new AngularJsAspNetCore7 project alongside the original to demonstrate the modernized architecture.

Key Changes:

  • Created new ASP.NET Core 7 Web API project with proper CORS configuration
  • Migrated LandingController from MVC controller (returning views) to API controller (returning JSON)
  • Replaced ASP.NET bundling system with static file serving
  • Moved all AngularJS frontend files to wwwroot directory
  • Created static HTML file to replace Razor view for bootstrapping AngularJS
  • Configured application to run on same port (51267) for compatibility

Review & Testing Checklist for Human

Risk Level: 🟡 Medium - Architectural migration with multiple integration points

  • End-to-end functionality test: Navigate to http://localhost:51267 and verify AngularJS app loads with both test component and directive displaying correct version numbers
  • API endpoint verification: Test http://localhost:51267/api/landing returns proper JSON response and CORS headers allow frontend requests
  • File completeness audit: Compare wwwroot structure with original WebApp directory to ensure all files were copied correctly
  • Performance comparison: Check if individual script tags load acceptably vs original bundled assets
  • Cross-browser testing: Verify functionality works across different browsers since bundling optimizations were removed

Test Plan: Run dotnet run in AngularJsAspNetCore7 directory, open browser to localhost:51267, verify both AngularJS components render, then test API endpoint directly.


Diagram

%%{ init : { "theme" : "default" }}%%
graph TB
    subgraph "Original .NET Framework 4.8"
        OldController["Controllers/LandingController.cs<br/>(Returns View)"]:::context
        OldView["Views/Landing/Index.cshtml<br/>(Razor View)"]:::context
        OldBundle["App_Start/BundleConfig.cs<br/>(Asset Bundling)"]:::context
        OldWebApp["WebApp/<br/>(AngularJS Files)"]:::context
    end
    
    subgraph "New ASP.NET Core 7"
        NewController["AngularJsAspNetCore7/Controllers/LandingController.cs<br/>(API Controller)"]:::major-edit
        Program["AngularJsAspNetCore7/Program.cs<br/>(CORS + Static Files)"]:::major-edit
        StaticHTML["AngularJsAspNetCore7/wwwroot/index.html<br/>(Static Bootstrap)"]:::major-edit
        StaticFiles["AngularJsAspNetCore7/wwwroot/WebApp/<br/>(Copied AngularJS Files)"]:::minor-edit
        StaticAssets["AngularJsAspNetCore7/wwwroot/node_modules/<br/>(jQuery + Angular)"]:::minor-edit
    end
    
    OldController -.->|"Migrated to API"| NewController
    OldView -.->|"Replaced with"| StaticHTML
    OldBundle -.->|"Replaced with"| StaticFiles
    OldWebApp -.->|"Copied to"| StaticFiles
    
    StaticHTML -->|"Loads"| StaticAssets
    StaticHTML -->|"Bootstraps"| StaticFiles
    
    subgraph Legend
        L1["Major Edit"]:::major-edit
        L2["Minor Edit"]:::minor-edit  
        L3["Context/No Edit"]:::context
    end
    
    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

  • Architecture Decision: Created new project alongside original rather than modifying in-place to preserve reference implementation
  • CORS Configuration: Configured for http://localhost:51267 - may need adjustment for production deployment
  • Bundle Replacement: Replaced optimized bundling with individual script tags - consider impact on load performance
  • API Endpoint: Current API returns sample data; may need to be enhanced based on actual frontend requirements
  • Testing: Local testing confirmed basic functionality, but production scenarios need validation

Session Info:

Screenshots from local testing:
AngularJS Frontend
API Endpoint

- Created new ASP.NET Core 7 Web API project structure
- Migrated LandingController to API controller with JSON endpoints
- Configured static file serving for AngularJS frontend in wwwroot
- Set up CORS for localhost:51267 to allow frontend-API communication
- Replaced Razor view with static HTML file to bootstrap AngularJS
- Preserved all AngularJS functionality and styling
- Maintained route compatibility for seamless frontend integration

The new ASP.NET Core 7 Web API serves the AngularJS application at
localhost:51267 and provides API endpoints at /api/landing.

Tested locally and verified:
- AngularJS frontend loads correctly with test components
- API endpoints return proper JSON responses
- CORS allows frontend-to-API communication
- All styling and functionality preserved

Co-Authored-By: Shawn Azman <shawn.d.azman@gmail.com>
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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.

0 participants