Skip to main content

Overview

The CE_Reservas entity represents a reservation for a sports court. It links clients, courts, and users while managing the reservation schedule and status.

Properties

Entity Definition

public class CE_Reservas
{
    public int IdReserva { get; set; }
    public int IdCancha { get; set; }
    public int IdCliente { get; set; }
    public int IdUsuario { get; set; }
    public DateTime FechaReserva { get; set; }
    public TimeSpan HoraInicio { get; set; }
    public TimeSpan HoraFin { get; set; }
    public string? NombreCliente { get; set; }
    public String? NombreCancha { get; set; }
    public string? Comentario { get; set; }
    public bool Estado { get; set; }
}

ViewModels

ReservaViewModel

View model used for reservation management operations, combining a reservation with lists of available clients and courts.
public class ReservaViewModel
{
    public CE_Reservas Reserva { get; set; }
    public List<CE_Clientes> ListaClientes { get; set; }
    public List<CE_Canchas> ListaCanchas { get; set; }
}

Usage Example

// Creating a new reservation
var reserva = new CE_Reservas
{
    IdReserva = 1,
    IdCancha = 1,
    IdCliente = 1,
    IdUsuario = 1,
    FechaReserva = DateTime.Now.Date,
    HoraInicio = new TimeSpan(14, 0, 0), // 2:00 PM
    HoraFin = new TimeSpan(16, 0, 0),    // 4:00 PM
    NombreCliente = "Juan Pérez",
    NombreCancha = "Cancha Fútbol 1",
    Comentario = "Torneo local",
    Estado = true
};

// Using the ViewModel
var viewModel = new ReservaViewModel
{
    Reserva = reserva,
    ListaClientes = new List<CE_Clientes>(),
    ListaCanchas = new List<CE_Canchas>()
};

Build docs developers (and LLMs) love