Skip to content

Latest commit

 

History

History
32 lines (28 loc) · 2.12 KB

README.md

File metadata and controls

32 lines (28 loc) · 2.12 KB

ASP.NET Core MVC File Upload Starter Project

A website for uploading photos. The website resizes photos and associates them with database items. Authorized users can create/edit/delete items and add/remove photos for each item.

Environment:

  • Visual Studio 2022 Community Edition
  • .NET Core 6.0
  • Bootstrap 5.1
  • SQL Server Express
  • Entity Framework Core 6.01 Code First

Installation:

Open the solution file in Visual Studio, then:

  1. From Solution Explorer, right click on the project solution (very top line).
  2. Select Restore Client-Side Libraries from the drop-down menu.
  3. From the Visual Studio 2022 main menu, select: Tools->NuGet Package Manager->Package Manager Console
  4. Enter the following two commands into the console:

Add-Migration Initial

Update-Database

You will also need to grant your web server write access to the folder wwwroot/pics.

Description:

The purpose of this project is to give a head-start on back-end code. This project contains all the code generated by Visual Studio using the template for a new ASP.NET Core Web App (Model-View-Controller) project. I then had Visual Studio generate scaffolding using 'Add MVC Controller with Views, Using Entity Framework'. Changes and additions I made to the resultant code include:

  • Added code to allow Admin users to create/modify items and upload photos for each item. The code creates three copies of each photo; original size, medium size, and small size.
  • Implemented a Bootstrap carousel to display the uploaded photos for each item.
  • Added cookie authentication to secure administrative functions. You will find the login credentials in appsettings.json.
  • Created POCO classes for Item and Photo. Each Item contains its own collection of Photos.
  • Restructured the generated database code. I added UnitOfWork and Repository classes so transaction processing can more easily be implemented across multiple tables.
  • Updated Bootstrap, JQuery, and FontAwesome to latest versions.

Minimal styling has been done to the views. You will need to design the front-end to your own requirements. You will need to add much more code to make a production website.