GithubHelp home page GithubHelp logo

oscarlojr / api-contato-csharp Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 20 KB

This project description provides a concise overview of the Contact API, highlighting its purpose, core functionalities, and underlying technologies.

License: MIT License

C# 100.00%
api crud-api csharp dotnet dotnet-api

api-contato-csharp's Introduction

Contact API

This repository contains the source code for the Contact API, an ASP.NET Core application that manages contacts in an agenda. The API allows you to create, retrieve, edit, and delete contacts. Below are the usage instructions and details of the available routes.

Project Structure

  • API_Contato.Context: Contains the Entity Framework context definition for the application.
  • API_Contato.Entities: Defines domain entities, such as Contato.
  • API_Contato.Controllers: Contains controllers that expose the APIs for contact management.

Endpoints

Create Contact

  • Route: POST /contato
  • Description: Creates a new contact.
  • Parameters:
    • contato: JSON object with contact information (Name, Phone, Active).
  • Response:
    • 200 OK: Contact successfully created.
    • 400 Bad Request: Error in creating contact.

Get Contact by ID

  • Route: GET /contato/{id}
  • Description: Retrieves a contact by ID.
  • Parameters:
    • id: Contact ID.
  • Response:
    • 200 OK: Contact found.
    • 404 Not Found: Contact not found.

Get Contact by Name

  • Route: GET /contato/ObterPorNome
  • Description: Retrieves contacts that contain the specified name.
  • Parameters:
    • nome: Name or part of the contact's name.
  • Response:
    • 200 OK: List of contacts found.
    • 404 Not Found: No contacts found.

Edit Contact by ID

  • Route: PUT /contato/{id}
  • Description: Edits the information of a contact by ID.
  • Parameters:
    • id: Contact ID.
    • contato: JSON object with the updated contact information.
  • Response:
    • 200 OK: Contact successfully edited.
    • 404 Not Found: Contact not found.

Delete Contact by ID

  • Route: DELETE /contato/{id}
  • Description: Deletes a contact by ID.
  • Parameters:
    • id: Contact ID.
  • Response:
    • 204 No Content: Contact successfully deleted.
    • 404 Not Found: Contact not found.

How to Run

Prerequisites

  • .NET Core SDK
  • Configured database (e.g., SQL Server, SQLite, etc.)

Configuration

  1. Clone the repository:

    git clone https://github.com/your-username/ContactAPI.git
    cd ContactAPI
  2. Configure the connection string in the appsettings.json file:

    "ConnectionStrings": {
      "DefaultConnection": "YourConnectionStringHere"
    }
  3. Apply migrations to set up the database:

    dotnet ef database update

Run the Application

To start the application, use the command:

dotnet run

This README.md provides an overview of the API, describes the available endpoints, explains how to configure and run the application, and includes information on how to contribute and the project license.

Contribution

Contributions are welcome! Feel free to open issues and pull requests for improvements and fixes.

License

This project is licensed under the MIT License.

api-contato-csharp's People

Contributors

oscarlojr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.