Skip to content

This ASP.NET MVC application is designed to manage clients in an MSSQL database, allowing CRUD operations on the "Cliente" entity. The application includes three main views: Index, New, and Edit.

License

Notifications You must be signed in to change notification settings

Anyel-ec/ASP.NET-Client-ViewModel-CRUD-MSSQL

Repository files navigation

MVC Application for Client Management - CRUD in MSSQL

This ASP.NET MVC application is designed to manage clients in an MSSQL database, allowing CRUD operations (Create, Read, Update, Delete) on the "Cliente" entity. The application includes three main views: Index, Nuevo (New), and Editar (Edit).

Select Language:

Result

Home

Alt text

New Client

Alt text

Edit Client

Alt text

Delete

Alt text

Delete After

Alt text

Table of Contents

  1. Initial Setup
  2. Project Structure
  3. Main Views
  4. Cliente Model
  5. Cliente Controller
  6. Database

Initial Setup

Before running the application, ensure that your MSSQL database is configured and update the connection string in the web.config file.

<connectionStrings>
    <add name="lab2Entities" connectionString="YourConnectionString" providerName="System.Data.SqlClient" />
</connectionStrings>

Project Structure

  • Models: Contains model classes for the Cliente entity and the view model used in the Index view.
  • Views/Cliente: Contains the Index, Nuevo, and Editar views.
  • Controllers: Contains the ClienteController controller that manages CRUD operations.
  • Scripts: Contains jQuery scripts for datepicker functionality.
  • Content: Contains CSS style files.

Main Views

Index.cshtml

The main view displaying a table with the list of clients. Allows editing and deletion operations.

Nuevo.cshtml

Enables adding new clients through a form. Includes data validation using Data Annotations and a jQuery datepicker for selecting birthdates.

Editar.cshtml

Similar to Nuevo.cshtml, but designed for editing existing clients.


Cliente Model

public class ClienteViewModel
{
    // Properties of the Cliente model
    // ...
}

public class ListClienteViewModel
{
    // Properties of the ListClienteViewModel model
    // ...
}

Cliente Controller

The ClienteController controller handles CRUD operations for the Cliente entity. Some key actions include:

  • Index: Displays the list of clients.
  • Nuevo: Allows adding a new client.
  • Editar: Allows editing an existing client.
  • Eliminar: Allows deleting a client.

Database

The application uses an MSSQL database named lab2Entities. Ensure that the cliente table with the necessary fields is created. You can use Entity Framework Code First Migrations to manage database migrations.


We hope this application proves useful! If you encounter any issues or have suggestions for improvement, feel free to contribute to the project. Thank you for using this ASP.NET MVC application!

About

This ASP.NET MVC application is designed to manage clients in an MSSQL database, allowing CRUD operations on the "Cliente" entity. The application includes three main views: Index, New, and Edit.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published