DEV Community

Cover image for Navigating a Standard .NET API Service: A Real Estate Example
Jose Maria Iriarte
Jose Maria Iriarte

Posted on

Navigating a Standard .NET API Service: A Real Estate Example

The Buenos Aires Real Estate API Service is a a cutting-edge .NET 7 / EFCore supported API that offers easy access to apartment complex and apartment unit information.

GitHub logo tigerbluejay / Buenos-Aires-Real-Estate-API

A real estate API service exposing apartment complex and apartment unit related (CRUD) endpoints. The service also integrates .NET identity for login, registration and authentication.

Buenos-Aires-Real-Estate-API

A real state API service exposing Apartment Unit Rental Information in the City of Buenos Aires.

Project Structure

The API Service Solution is comprised of four core projects: The API which houses core functionality, a Data Project which handles data access, a Models Project which contains the Models and DTOs for the Solution and a Utilities Project with ancilliary code to assist.

BuenosAiresRealEstate.API

Controllers

The API Project houses the two core sections of the Project. One is the Controllers, which are defined in different version folders. Version 2 of the ApartmentComplexController serves to show how you can work with in memory data. But the core controllers are the ApartmentComplexController and the ApartmentUnitController. Each apartment complex has units associated to it, and both can be retrieved (Get All and Get by Id), created, updated and deleted with the methods defined in these controllers. There is also a UsersController which implements…

This API is meticulously designed to cater to a diverse range of services and applications, but it can also work stand-alone with Swagger UI integration, making it an ideal tool for demonstrations and learning.

Swagger UI

The API's endpoints are crafted to enhance user experience. The ApartmentComplex controller, boasts two distinct Get methods catering to both general apartment complex retrieval and specific complex retrieval by ID. The controller further opens avenues for basic Create, Update, and Delete operations.

Swagger Endpoint

Diving deeper, the ApartmentUnit endpoints, mirror common HTTP verbs – allowing the client to fetch all units and specific units by ID, creating, updating, and deleting units.

A highlight of this API is the UsersController, which facilitates seamless user interaction. With the power of .NET Identity and Swagger integrations, effortlessly register and login, and obtain JWT Bearer Token for authorization. With this token in hand, you can unlock restricted actions defined within the API.

Program.cs

Get Action

The solution's beginner-to-intermediate friendly design, punctuated with annotations, ensures developers of varying expertise can easily work with it.

For a comprehensive understanding of the application's structure, the GitHub Repo's Readme file offers a detailed breakdown. Suffice it to say here that the Solution is comprised of four distinct projects – the Core API, the Data Access Layer, the Models and Data Transfer Objects Layer, and a Utilities Addendum.

Solution Explorer

Top comments (0)