Skip to content

Latest commit

 

History

History
141 lines (102 loc) · 4.22 KB

README.md

File metadata and controls

141 lines (102 loc) · 4.22 KB

Dr. Sneuss Absurd Machine Repair

Application made for Epicodus to demonstrate understanding of many-to-many relationships in MySQL using ASP.net core and mvc with entity framework

ABOUT

This Machine repair app is designed to help Dr. Sneuss keep track of his engineers and machine repairs. This app utilizes razor, c#, asp.net core, mvc with entity framework using the CRUD naming convention.

REQUIREMENTS

SETUP

copy this url to clone this project to your local system:

https://github.com/jhenager/DrSneuss.Solution.git

Once copied, select "Clone Repository" from within VSCode & paste the copied link.


With the project open to the root directory, navigate to the production directory with the following command in your terminal.

cd DrSneuss

Then, install the necessary packages with the following command

dotnet restore 

Finally, you can start the program with this command.

dotnet run 

Setting up the database


Next we will need to setup our MySql database for the application to work.
One method is to directly import the 'james_henager.sql' file included in the repo to MySQL workbench.
The other option is to open MySql Workbench and select "Create a new Sql Tab for Executing Queries" at the very top left of the page. Then paste this information onto the page:
CREATE DATABASE `james_henager` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */;
USE DATABASE `james_henager`
CREATE TABLE `Engineers` (
  `EngineerId` int(11) NOT NULL AUTO_INCREMENT,
  `EngineerName` longtext,
  PRIMARY KEY (`EngineerId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `MachineEngineer` (
  `MachineEngineerId` int(11) NOT NULL AUTO_INCREMENT,
  `MachineId` int(11) NOT NULL,
  `EngineerId` int(11) NOT NULL,
  PRIMARY KEY (`MachineEngineerId`),
  KEY `IX_MachineEngineer_EngineerId` (`EngineerId`),
  KEY `IX_MachineEngineer_MachineId` (`MachineId`),
  CONSTRAINT `FK_MachineEngineer_Engineers_EngineerId` FOREIGN KEY (`EngineerId`) REFERENCES `engineers` (`EngineerId`) ON DELETE CASCADE,
  CONSTRAINT `FK_MachineEngineer_Machines_MachineId` FOREIGN KEY (`MachineId`) REFERENCES `machines` (`MachineId`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `Machines` (
  `MachineId` int(11) NOT NULL AUTO_INCREMENT,
  `MachineName` longtext,
  `Date` datetime(6) NOT NULL DEFAULT '0001-01-01 00:00:00.000000',
  `MachineError` longtext,
  PRIMARY KEY (`MachineId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

Then, you need to update your username and password in the appsettings.json file.

by default these are set to user:root and an empty password. if you are unsure, refer to the settings for your MySqlWorkbench.



PROTECTING YOUR DATA

Step 1: From within VSCode in the root project directory, we will create a .gitignore file

For l-top

touch .gitignore 

For l-top

ni .gitignore 

Step 2: Add the following to your .gitignore file (this protects your sensitive data).

DO NOT PROCEED UNTIL YOU DO!

node_modules/
.DS_store
dist/
appsettings.json
bin/
obj/

Step 3: To commit your .gitignore file enter the following commands

git add .gitignore
git commit -m "protect data"

QUESTIONS AND CONCERNS

Questions, comments and concerns can be directed to James Henager (jameschenager@gmail.com)


Technologies Used

Written in: Visual Studio Code

Database Mgmt: MySql Workbench