Skip to content
Open

ok #45

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/master_dbap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy ASP app to Azure Web App - dbAp

on:
push:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Setup MSBuild path
uses: microsoft/setup-msbuild@v1.0.2

- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5

- name: Restore NuGet packages
run: nuget restore

- name: Publish to folder
run: msbuild /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="\published\"

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: ASP-app
path: '/published/**'

deploy:
runs-on: windows-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: ASP-app

- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_47EFC7E044B3412AA9BB1856B26607D6 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_8A1EE0DC00864F76B2F74F4207E34D34 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_79FA4D7AB3BC4FED925A3206257953C3 }}

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'dbAp'
slot-name: 'Production'
package: .

27 changes: 23 additions & 4 deletions Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,45 @@ public class UserController : Controller
// GET: User
public ActionResult Index()
{
// Implement the Index method here
view(userlist);
}

// GET: User/Details/5
public ActionResult Details(int id)
{
// Implement the details method here
// This method is responsible for displaying the details of a user with the specified ID.
// It retrieves the user from the userlist based on the provided ID and passes it to the Details view.
var user = userlist.FirstOrDefault(u => u.Id == id);
if (user == null)
{
return HttpNotFound();
}
return View(user);
}

// GET: User/Create
// GET: User/Create
public ActionResult Create()
{
//Implement the Create method here
return View();
}

// POST: User/Create
[HttpPost]
public ActionResult Create(User user)
{
// Implement the Create method (POST) here
// This method is responsible for handling the HTTP POST request to create a new user.
// It receives user input from the form submission and adds the new user to the userlist.
// If successful, it redirects to the Index action to display the updated list of users.
// If an error occurs during the process, it returns the Create view to display any validation errors.

if (ModelState.IsValid)
{
userlist.Add(user);
return RedirectToAction("Index");
}

return View(user);
}

// GET: User/Edit/5
Expand Down
69 changes: 69 additions & 0 deletions Read.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Contact Database Application

This repository contains the source code and documentation for a contact database application. The application allows users to store and manage their contacts in a convenient and organized manner.

## Features

- Add new contacts with details such as name, phone number, email, and address.
- View a list of all contacts in the database.
- Search for specific contacts based on name, phone number, or email.
- Update contact information.
- Delete contacts from the database.

## Installation

1. Clone the repository to your local machine.
2. Install the required dependencies by running `npm install`.
3. Set up the database connection by configuring the database credentials in the `.env` file.
4. Start the application by running `npm start`.

## Usage

1. Open the application in your web browser.
2. Register a new account or log in with your existing credentials.
3. Once logged in, you will be redirected to the contacts page.
4. Use the provided forms to add, update, or delete contacts.
5. Use the search functionality to find specific contacts.
6. Enjoy managing your contacts efficiently!

## Contributing

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.

## License

This project is licensed under the [MIT License](LICENSE).
## Getting Started

To get started with this C# application, follow the steps below:

### Prerequisites

- [.NET Core SDK](https://dotnet.microsoft.com/download) installed on your machine.

### Installation

1. Clone the repository to your local machine.
2. Open the project in your preferred IDE or text editor.

### Usage

1. Build the project using the command `dotnet build`.
2. Run the application using the command `dotnet run`.
3. Follow the on-screen instructions to interact with the contact database.

### Features

- Add new contacts with details such as name, phone number, email, and address.
- View a list of all contacts in the database.
- Search for specific contacts based on name, phone number, or email.
- Update contact information.
- Delete contacts from the database.

### Contributing

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.

### License

This project is licensed under the [MIT License](LICENSE).
106 changes: 106 additions & 0 deletions deploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appName": {
"type": "string",
"metadata": {
"description": "The name of the application."
}
},
"location": {
"type": "string",
"metadata": {
"description": "The location where the resources will be deployed."
}
},
"databaseName": {
"type": "string",
"metadata": {
"description": "The name of the database."
}
},
"databaseUsername": {
"type": "string",
"metadata": {
"description": "The username for the database."
}
},
"databasePassword": {
"type": "securestring",
"metadata": {
"description": "The password for the database."
}
},
"appServicePlanName": {
"type": "string",
"metadata": {
"description": "The name of the App Service Plan."
}
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2021-04-01",
"name": "deployApp",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2021-02-01",
"name": "[parameters('appName')]",
"location": "[parameters('location')]",
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]"
}
},
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2021-02-01-preview",
"name": "[parameters('databaseName')]",
"location": "[parameters('location')]",
"properties": {
"collation": "SQL_Latin1_General_CP1_CI_AS",
"edition": "Basic",
"maxSizeBytes": "1073741824",
"requestedServiceObjectiveName": "Basic",
"sampleName": "AdventureWorksLT",
"elasticPoolId": "[resourceId('Microsoft.Sql/servers/elasticPools', 'elasticPoolName')]"
},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', 'sqlServerName')]"
]
}
]
},
"parameters": {
"appName": {
"value": "[parameters('appName')]"
},
"location": {
"value": "[parameters('location')]"
},
"databaseName": {
"value": "[parameters('databaseName')]"
},
"databaseUsername": {
"value": "[parameters('databaseUsername')]"
},
"databasePassword": {
"value": "[parameters('databasePassword')]"
},
"appServicePlanName": {
"value": "[parameters('appServicePlanName')]"
}
}
}
}
],
"outputs": {}
}