a ver si no me olcideo de commitear otra vez
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="Entidades\Entidades.csproj" />
|
||||
<ProjectReference Include="..\Entidades\Entidades.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
@@ -21,17 +20,16 @@ public class HomeController : Controller
|
||||
public IActionResult Inquilino(){
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
public IActionResult InquilinoForm(long? id = 0)
|
||||
{
|
||||
return View(
|
||||
//new ErrorViewModel { RequestId = Activity.Class1 };
|
||||
new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }
|
||||
);
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,9 +26,10 @@ public class InquilinoController: ControllerBase
|
||||
[HttpPost]
|
||||
public IActionResult Post([FromForm] Inquilino inq){
|
||||
if (inq == null) return BadRequest("Inquilino inválido.");
|
||||
if (inq.Dni == "0" || inq.Dni == null) return BadRequest("No se especifico dni");
|
||||
if (inq.Dni == 0 ) return BadRequest("No se especifico dni");
|
||||
if (inq.Dni < 0 ) return BadRequest("Dni Invalido");
|
||||
|
||||
|
||||
inquilinos.Add(inq);
|
||||
|
||||
return Content($"<p>Inquilino {inq.Nombre} agregado exitosamente.</p>", "text/html");
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
namespace Modelo
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,37 +20,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3>Dar de alta</h3>
|
||||
<form hx-post="/api/inquilino" hx-target="#responce" hx-swap="innerHTML">
|
||||
<label for="Dni">Dni:</label>
|
||||
<input type="text" id="Dni" name="Dni" required>
|
||||
<br>
|
||||
|
||||
<label for="Cuil">Cuil:</label>
|
||||
<input type="text" id="Cuil" name="Cuil" required>
|
||||
<br>
|
||||
<button hx-get="/Home/InquilinoForm/0" hx-target="#addInquilino" hx-swap="innerHTML">Añadir Inquilino</button>
|
||||
|
||||
<label for="nombre">Nombre:</label>
|
||||
<input type="text" id="nombre" name="nombre" required>
|
||||
<br>
|
||||
<div id="addInquilino"></div>
|
||||
|
||||
<label for="apellido">Apellido:</label>
|
||||
<input type="text" id="Apellido" name="apellido" required>
|
||||
<br>
|
||||
|
||||
<label for="Domicilio">Domicilio:</label>
|
||||
<input type="text" id="Domicilio" name="Domicilio" required>
|
||||
<br>
|
||||
|
||||
<label for="Email">Email:</label>
|
||||
<input type="text" id="Email" name="Email" required>
|
||||
<br>
|
||||
|
||||
<span id="responce"></span>
|
||||
|
||||
<button
|
||||
type="submit">Agregar Inquilino</button>
|
||||
</form>
|
||||
|
||||
|
||||
</button>
|
||||
36
Aspnet/Views/Home/InquilinoForm.cshtml
Normal file
36
Aspnet/Views/Home/InquilinoForm.cshtml
Normal file
@@ -0,0 +1,36 @@
|
||||
<form hx-post="/api/inquilino" hx-swap="outerHTML" hx-on="htmx:afterRequest: hx-get='/api/inquilino' hx-target='#inquilino-data' hx-swap='innerHTML'">
|
||||
<label for="Dni">Dni:</label><br>
|
||||
<input type="number" id="Dni" name="Dni" min="1" step="1" required>
|
||||
<br>
|
||||
|
||||
<label for="Cuil">Cuil:</label><br>
|
||||
<input type="number" id="Cuil" name="Cuil" min="1" step="1" required>
|
||||
<br>
|
||||
|
||||
<label for="nombre">Nombre:</label><br>
|
||||
<input type="text" id="nombre" name="nombre" required>
|
||||
<br>
|
||||
|
||||
<label for="apellido">Apellido:</label><br>
|
||||
<input type="text" id="Apellido" name="apellido" required>
|
||||
<br>
|
||||
|
||||
<label for="Domicilio">Domicilio:</label><br>
|
||||
<input type="text" id="Domicilio" name="Domicilio" required>
|
||||
<br>
|
||||
|
||||
<label for="Email">Email:</label><br>
|
||||
<input type="email" id="Email" name="Email" required>
|
||||
<br>
|
||||
|
||||
<label for="Contraseña">Contraseña:</label><br>
|
||||
<input type="text" id="Contraseña" name="Contraseña" required>
|
||||
<br>
|
||||
|
||||
<label for="Celular">Celular:</label><br>
|
||||
<input type="tel" id="Celular" name="Celular" required>
|
||||
<br>
|
||||
|
||||
<button
|
||||
type="submit">Agregar Inquilino</button>
|
||||
</form>
|
||||
@@ -1,25 +0,0 @@
|
||||
@model Modelo.ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
@@ -1,3 +1,2 @@
|
||||
@using AlquilaFacil
|
||||
@using Modelo
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
478
Entidades/AlquilaFacilContext.cs
Normal file
478
Entidades/AlquilaFacilContext.cs
Normal file
@@ -0,0 +1,478 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class AlquilaFacilContext : DbContext
|
||||
{
|
||||
public AlquilaFacilContext()
|
||||
{
|
||||
}
|
||||
|
||||
public AlquilaFacilContext(DbContextOptions<AlquilaFacilContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<Canon> Canons { get; set; }
|
||||
|
||||
public virtual DbSet<Contrato> Contratos { get; set; }
|
||||
|
||||
public virtual DbSet<Defecto> Defectos { get; set; }
|
||||
|
||||
public virtual DbSet<Garante> Garantia { get; set; }
|
||||
|
||||
public virtual DbSet<Grupo> Grupos { get; set; }
|
||||
|
||||
public virtual DbSet<Inquilino> Inquilinos { get; set; }
|
||||
|
||||
public virtual DbSet<Propiedad> Propiedades { get; set; }
|
||||
|
||||
public virtual DbSet<Propietario> Propietarios { get; set; }
|
||||
|
||||
public virtual DbSet<Recibo> Recibos { get; set; }
|
||||
|
||||
public virtual DbSet<Rol> Rols { get; set; }
|
||||
|
||||
public virtual DbSet<Servicio> Servicios { get; set; }
|
||||
|
||||
public virtual DbSet<ServicioPropiedade> ServicioPropiedades { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
//#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
||||
=> optionsBuilder.UseSqlServer("Server=fedesrv.ddns.net,1433;Database=AlquilaFacil;User Id=AlquilaFacil;Password=.n@9c2ve*0,b1ETv].Kipa/~pR~V;Trusted_Connection=False;Encrypt=False;Connection Timeout=5;\n");
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Canon>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__CANON__3214EC27DAD9CBBD");
|
||||
|
||||
entity.ToTable("CANON");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.Idrecibo).HasColumnName("IDRECIBO");
|
||||
entity.Property(e => e.Mes).HasColumnName("MES");
|
||||
entity.Property(e => e.Monto)
|
||||
.HasColumnType("decimal(12, 2)")
|
||||
.HasColumnName("MONTO");
|
||||
entity.Property(e => e.Pagado).HasColumnName("PAGADO");
|
||||
|
||||
entity.HasOne(d => d.IdreciboNavigation).WithMany(p => p.Canons)
|
||||
.HasForeignKey(d => d.Idrecibo)
|
||||
.HasConstraintName("FK__CANON__IDRECIBO__540C7B00");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Contrato>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__CONTRATO__3214EC27314E1A88");
|
||||
|
||||
entity.ToTable("CONTRATO");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.Dniinquilino).HasColumnName("DNIINQUILINO");
|
||||
entity.Property(e => e.Dnipropietario).HasColumnName("DNIPROPIETARIO");
|
||||
entity.Property(e => e.Duracionmeses).HasColumnName("DURACIONMESES");
|
||||
entity.Property(e => e.Fechainicio)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("FECHAINICIO");
|
||||
entity.Property(e => e.Idpropiedad).HasColumnName("IDPROPIEDAD");
|
||||
entity.Property(e => e.Indiceactualizacion)
|
||||
.HasColumnType("decimal(12, 2)")
|
||||
.HasColumnName("INDICEACTUALIZACION");
|
||||
entity.Property(e => e.Monto)
|
||||
.HasColumnType("decimal(12, 2)")
|
||||
.HasColumnName("MONTO");
|
||||
|
||||
entity.HasOne(d => d.DniinquilinoNavigation).WithMany(p => p.Contratos)
|
||||
.HasForeignKey(d => d.Dniinquilino)
|
||||
.HasConstraintName("FK__CONTRATO__DNIINQ__01142BA1");
|
||||
|
||||
entity.HasOne(d => d.DnipropietarioNavigation).WithMany(p => p.Contratos)
|
||||
.HasForeignKey(d => d.Dnipropietario)
|
||||
.HasConstraintName("FK__CONTRATO__DNIPRO__02084FDA");
|
||||
|
||||
entity.HasOne(d => d.IdpropiedadNavigation).WithMany(p => p.Contratos)
|
||||
.HasForeignKey(d => d.Idpropiedad)
|
||||
.HasConstraintName("FK__CONTRATO__IDPROP__02FC7413");
|
||||
|
||||
entity.HasMany(d => d.Dnigarantia).WithMany(p => p.Idcontratos)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"ContratoGarantium",
|
||||
r => r.HasOne<Garante>().WithMany()
|
||||
.HasForeignKey("Dnigarantia")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__CONTRATO___DNIGA__282DF8C2"),
|
||||
l => l.HasOne<Contrato>().WithMany()
|
||||
.HasForeignKey("Idcontrato")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__CONTRATO___IDCON__2739D489"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Idcontrato", "Dnigarantia").HasName("PK__CONTRATO__08D9A618A2AF4EE5");
|
||||
j.ToTable("CONTRATO_GARANTIA");
|
||||
j.IndexerProperty<int>("Idcontrato").HasColumnName("IDCONTRATO");
|
||||
j.IndexerProperty<long>("Dnigarantia").HasColumnName("DNIGARANTIA");
|
||||
});
|
||||
|
||||
entity.HasMany(d => d.Idcanons).WithMany(p => p.Idcontratos)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"ContratoCanon",
|
||||
r => r.HasOne<Canon>().WithMany()
|
||||
.HasForeignKey("Idcanon")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__CONTRATO___IDCAN__3493CFA7"),
|
||||
l => l.HasOne<Contrato>().WithMany()
|
||||
.HasForeignKey("Idcontrato")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__CONTRATO___IDCON__339FAB6E"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Idcontrato", "Idcanon").HasName("PK__CONTRATO__EAB1D189E5C1886B");
|
||||
j.ToTable("CONTRATO_CANON");
|
||||
j.IndexerProperty<int>("Idcontrato").HasColumnName("IDCONTRATO");
|
||||
j.IndexerProperty<int>("Idcanon").HasColumnName("IDCANON");
|
||||
});
|
||||
|
||||
entity.HasMany(d => d.Iddefectos).WithMany(p => p.Idcontratos)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"ContratoDefecto",
|
||||
r => r.HasOne<Defecto>().WithMany()
|
||||
.HasForeignKey("Iddefecto")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__CONTRATO___IDDEF__2BFE89A6"),
|
||||
l => l.HasOne<Contrato>().WithMany()
|
||||
.HasForeignKey("Idcontrato")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__CONTRATO___IDCON__2B0A656D"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Idcontrato", "Iddefecto").HasName("PK__CONTRATO__3A449B2F445D3682");
|
||||
j.ToTable("CONTRATO_DEFECTO");
|
||||
j.IndexerProperty<int>("Idcontrato").HasColumnName("IDCONTRATO");
|
||||
j.IndexerProperty<int>("Iddefecto").HasColumnName("IDDEFECTO");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Defecto>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__DEFECTO__3214EC27E043B726");
|
||||
|
||||
entity.ToTable("DEFECTO");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.Costo)
|
||||
.HasColumnType("decimal(12, 2)")
|
||||
.HasColumnName("COSTO");
|
||||
entity.Property(e => e.Descripcion)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("DESCRIPCION");
|
||||
entity.Property(e => e.Estaarreglado).HasColumnName("ESTAARREGLADO");
|
||||
entity.Property(e => e.Pagainquilino).HasColumnName("PAGAINQUILINO");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Garante>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Dni).HasName("PK__GARANTIA__C035B8DC8E6BAB11");
|
||||
|
||||
entity.ToTable("GARANTIA");
|
||||
|
||||
entity.HasIndex(e => e.Email, "UQ__GARANTIA__161CF724C0013CA1").IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.Celular, "UQ__GARANTIA__6758673E51796017").IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.Cuil, "UQ__GARANTIA__F46C15900DA7BBE1").IsUnique();
|
||||
|
||||
entity.Property(e => e.Dni).HasColumnName("DNI");
|
||||
entity.Property(e => e.Apellido)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("APELLIDO");
|
||||
entity.Property(e => e.Celular)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("CELULAR");
|
||||
entity.Property(e => e.Contrasena)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("CONTRASENA");
|
||||
entity.Property(e => e.Cuil).HasColumnName("CUIL");
|
||||
entity.Property(e => e.Domicilio)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("DOMICILIO");
|
||||
entity.Property(e => e.Domiciliolaboral)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("DOMICILIOLABORAL");
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("EMAIL");
|
||||
entity.Property(e => e.Lugartrabajo)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("LUGARTRABAJO");
|
||||
entity.Property(e => e.Nombre)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("NOMBRE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Grupo>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__GRUPO__3214EC2778FB625D");
|
||||
|
||||
entity.ToTable("GRUPO");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.Nombre)
|
||||
.HasMaxLength(20)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("NOMBRE");
|
||||
|
||||
entity.HasMany(d => d.Dnigarantia).WithMany(p => p.Idgrupos)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"GrupoGarantium",
|
||||
r => r.HasOne<Garante>().WithMany()
|
||||
.HasForeignKey("Dnigarantia")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__GRUPO_GAR__DNIGA__46B27FE2"),
|
||||
l => l.HasOne<Grupo>().WithMany()
|
||||
.HasForeignKey("Idgrupo")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__GRUPO_GAR__IDGRU__45BE5BA9"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Idgrupo", "Dnigarantia").HasName("PK__GRUPO_GA__F9F1F0A3A5F02DDF");
|
||||
j.ToTable("GRUPO_GARANTIA");
|
||||
j.IndexerProperty<int>("Idgrupo").HasColumnName("IDGRUPO");
|
||||
j.IndexerProperty<long>("Dnigarantia").HasColumnName("DNIGARANTIA");
|
||||
});
|
||||
|
||||
entity.HasMany(d => d.Dniinquilinos).WithMany(p => p.Idgrupos)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"GrupoInquilino",
|
||||
r => r.HasOne<Inquilino>().WithMany()
|
||||
.HasForeignKey("Dniinquilino")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__GRUPO_INQ__DNIIN__40058253"),
|
||||
l => l.HasOne<Grupo>().WithMany()
|
||||
.HasForeignKey("Idgrupo")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__GRUPO_INQ__IDGRU__3F115E1A"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Idgrupo", "Dniinquilino").HasName("PK__GRUPO_IN__FC8CB8C5DC668E46");
|
||||
j.ToTable("GRUPO_INQUILINO");
|
||||
j.IndexerProperty<int>("Idgrupo").HasColumnName("IDGRUPO");
|
||||
j.IndexerProperty<long>("Dniinquilino").HasColumnName("DNIINQUILINO");
|
||||
});
|
||||
|
||||
entity.HasMany(d => d.Dnipropietarios).WithMany(p => p.Idgrupos)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"GrupoPropietario",
|
||||
r => r.HasOne<Propietario>().WithMany()
|
||||
.HasForeignKey("Dnipropietario")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__GRUPO_PRO__DNIPR__4A8310C6"),
|
||||
l => l.HasOne<Grupo>().WithMany()
|
||||
.HasForeignKey("Idgrupo")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__GRUPO_PRO__IDGRU__498EEC8D"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Idgrupo", "Dnipropietario").HasName("PK__GRUPO_PR__D5806AB6196637D1");
|
||||
j.ToTable("GRUPO_PROPIETARIO");
|
||||
j.IndexerProperty<int>("Idgrupo").HasColumnName("IDGRUPO");
|
||||
j.IndexerProperty<long>("Dnipropietario").HasColumnName("DNIPROPIETARIO");
|
||||
});
|
||||
|
||||
entity.HasMany(d => d.Idrols).WithMany(p => p.Idgrupos)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"GrupoRol",
|
||||
r => r.HasOne<Rol>().WithMany()
|
||||
.HasForeignKey("Idrol")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__GRUPO_ROL__IDROL__3C34F16F"),
|
||||
l => l.HasOne<Grupo>().WithMany()
|
||||
.HasForeignKey("Idgrupo")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__GRUPO_ROL__IDGRU__3B40CD36"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Idgrupo", "Idrol").HasName("PK__GRUPO_RO__5035D4A88EFB1AF1");
|
||||
j.ToTable("GRUPO_ROL");
|
||||
j.IndexerProperty<int>("Idgrupo").HasColumnName("IDGRUPO");
|
||||
j.IndexerProperty<int>("Idrol").HasColumnName("IDROL");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Inquilino>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Dni).HasName("PK__INQUILIN__C035B8DC051D254F");
|
||||
|
||||
entity.ToTable("INQUILINO");
|
||||
|
||||
entity.HasIndex(e => e.Email, "UQ__INQUILIN__161CF724192A8FBF").IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.Celular, "UQ__INQUILIN__6758673EB3CC90D6").IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.Cuil, "UQ__INQUILIN__F46C1590EF9A325E").IsUnique();
|
||||
|
||||
entity.Property(e => e.Dni).HasColumnName("DNI");
|
||||
entity.Property(e => e.Apellido)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("APELLIDO");
|
||||
entity.Property(e => e.Celular)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("CELULAR");
|
||||
entity.Property(e => e.Contrasena)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("CONTRASENA");
|
||||
entity.Property(e => e.Cuil).HasColumnName("CUIL");
|
||||
entity.Property(e => e.Domicilio)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("DOMICILIO");
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("EMAIL");
|
||||
entity.Property(e => e.Nombre)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("NOMBRE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Propiedad>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__PROPIEDA__3214EC2739D8661A");
|
||||
|
||||
entity.ToTable("PROPIEDADES");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.Canthabitaciones).HasColumnName("CANTHABITACIONES");
|
||||
entity.Property(e => e.Dni).HasColumnName("DNI");
|
||||
entity.Property(e => e.Letra)
|
||||
.HasMaxLength(2)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("LETRA");
|
||||
entity.Property(e => e.Piso).HasColumnName("PISO");
|
||||
entity.Property(e => e.Tienecocina).HasColumnName("TIENECOCINA");
|
||||
entity.Property(e => e.Ubicacion)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("UBICACION");
|
||||
|
||||
entity.HasOne(d => d.DniNavigation).WithMany(p => p.Propiedades)
|
||||
.HasForeignKey(d => d.Dni)
|
||||
.HasConstraintName("FK__PROPIEDADES__DNI__44FF419A");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Propietario>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Dni).HasName("PK__PROPIETA__C035B8DC136518F4");
|
||||
|
||||
entity.ToTable("PROPIETARIO");
|
||||
|
||||
entity.HasIndex(e => e.Email, "UQ__PROPIETA__161CF7246E3AA1B6").IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.Celular, "UQ__PROPIETA__6758673E211BCB21").IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.Cuil, "UQ__PROPIETA__F46C15901A8D2463").IsUnique();
|
||||
|
||||
entity.Property(e => e.Dni).HasColumnName("DNI");
|
||||
entity.Property(e => e.Apellido)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("APELLIDO");
|
||||
entity.Property(e => e.Celular)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("CELULAR");
|
||||
entity.Property(e => e.Contrasena)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("CONTRASENA");
|
||||
entity.Property(e => e.Cuil).HasColumnName("CUIL");
|
||||
entity.Property(e => e.Domicilio)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("DOMICILIO");
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("EMAIL");
|
||||
entity.Property(e => e.Nombre)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("NOMBRE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Recibo>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__RECIBO__3214EC277135BC90");
|
||||
|
||||
entity.ToTable("RECIBO");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.Mes).HasColumnName("MES");
|
||||
entity.Property(e => e.Monto)
|
||||
.HasColumnType("decimal(12, 2)")
|
||||
.HasColumnName("MONTO");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Rol>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__ROL__3214EC27DE6A34BE");
|
||||
|
||||
entity.ToTable("ROL");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.Descipcion)
|
||||
.HasMaxLength(20)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("DESCIPCION");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Servicio>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__SERVICIO__3214EC27468ADAA2");
|
||||
|
||||
entity.ToTable("SERVICIO");
|
||||
|
||||
entity.HasIndex(e => e.Descripcion, "UQ__SERVICIO__794449EF1A4F44FF").IsUnique();
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.Descripcion)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("DESCRIPCION");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ServicioPropiedade>(entity =>
|
||||
{
|
||||
entity
|
||||
.HasNoKey()
|
||||
.ToTable("SERVICIO_PROPIEDADES");
|
||||
|
||||
entity.Property(e => e.Idpropiedad).HasColumnName("IDPROPIEDAD");
|
||||
entity.Property(e => e.Idservicio).HasColumnName("IDSERVICIO");
|
||||
|
||||
entity.HasOne(d => d.IdpropiedadNavigation).WithMany()
|
||||
.HasForeignKey(d => d.Idpropiedad)
|
||||
.HasConstraintName("FK__SERVICIO___IDPRO__49C3F6B7");
|
||||
|
||||
entity.HasOne(d => d.IdservicioNavigation).WithMany()
|
||||
.HasForeignKey(d => d.Idservicio)
|
||||
.HasConstraintName("FK__SERVICIO___IDSER__4AB81AF0");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
21
Entidades/Canon.cs
Normal file
21
Entidades/Canon.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Canon
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Mes { get; set; }
|
||||
|
||||
public decimal Monto { get; set; }
|
||||
|
||||
public bool Pagado { get; set; }
|
||||
|
||||
public int? Idrecibo { get; set; }
|
||||
|
||||
public virtual Recibo? IdreciboNavigation { get; set; }
|
||||
|
||||
public virtual ICollection<Contrato> Idcontratos { get; set; } = new List<Contrato>();
|
||||
}
|
||||
35
Entidades/Contrato.cs
Normal file
35
Entidades/Contrato.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Contrato
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public DateTime Fechainicio { get; set; }
|
||||
|
||||
public decimal Indiceactualizacion { get; set; }
|
||||
|
||||
public decimal Monto { get; set; }
|
||||
|
||||
public int Duracionmeses { get; set; }
|
||||
|
||||
public long? Dniinquilino { get; set; }
|
||||
|
||||
public long? Dnipropietario { get; set; }
|
||||
|
||||
public int? Idpropiedad { get; set; }
|
||||
|
||||
public virtual Inquilino? DniinquilinoNavigation { get; set; }
|
||||
|
||||
public virtual Propietario? DnipropietarioNavigation { get; set; }
|
||||
|
||||
public virtual Propiedad? IdpropiedadNavigation { get; set; }
|
||||
|
||||
public virtual ICollection<Garante> Dnigarantia { get; set; } = new List<Garante>();
|
||||
|
||||
public virtual ICollection<Canon> Idcanons { get; set; } = new List<Canon>();
|
||||
|
||||
public virtual ICollection<Defecto> Iddefectos { get; set; } = new List<Defecto>();
|
||||
}
|
||||
19
Entidades/Defecto.cs
Normal file
19
Entidades/Defecto.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Defecto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Descripcion { get; set; } = null!;
|
||||
|
||||
public bool Estaarreglado { get; set; }
|
||||
|
||||
public decimal Costo { get; set; }
|
||||
|
||||
public bool Pagainquilino { get; set; }
|
||||
|
||||
public virtual ICollection<Contrato> Idcontratos { get; set; } = new List<Contrato>();
|
||||
}
|
||||
@@ -6,4 +6,12 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
31
Entidades/Garante.cs
Normal file
31
Entidades/Garante.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Garante
|
||||
{
|
||||
public long Dni { get; set; }
|
||||
|
||||
public long Cuil { get; set; }
|
||||
|
||||
public string Nombre { get; set; } = null!;
|
||||
|
||||
public string Apellido { get; set; } = null!;
|
||||
|
||||
public string Email { get; set; } = null!;
|
||||
|
||||
public string Celular { get; set; } = null!;
|
||||
|
||||
public string Domicilio { get; set; } = null!;
|
||||
|
||||
public string Lugartrabajo { get; set; } = null!;
|
||||
|
||||
public string Domiciliolaboral { get; set; } = null!;
|
||||
|
||||
public byte[]? Contrasena { get; set; }
|
||||
|
||||
public virtual ICollection<Contrato> Idcontratos { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual ICollection<Grupo> Idgrupos { get; set; } = new List<Grupo>();
|
||||
}
|
||||
19
Entidades/Grupo.cs
Normal file
19
Entidades/Grupo.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Grupo
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Nombre { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Garante> Dnigarantia { get; set; } = new List<Garante>();
|
||||
|
||||
public virtual ICollection<Inquilino> Dniinquilinos { get; set; } = new List<Inquilino>();
|
||||
|
||||
public virtual ICollection<Propietario> Dnipropietarios { get; set; } = new List<Propietario>();
|
||||
|
||||
public virtual ICollection<Rol> Idrols { get; set; } = new List<Rol>();
|
||||
}
|
||||
@@ -1,35 +1,27 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades{
|
||||
namespace Entidades;
|
||||
|
||||
public class Inquilino
|
||||
public partial class Inquilino
|
||||
{
|
||||
public string Dni{ get; set; }
|
||||
public long Dni { get; set; }
|
||||
|
||||
public string Cuil{get; set;}
|
||||
public long Cuil { get; set; }
|
||||
|
||||
public string Nombre{get; set;}
|
||||
public string Nombre { get; set; } = null!;
|
||||
|
||||
public string Apellido {get; set;}
|
||||
public string Apellido { get; set; } = null!;
|
||||
|
||||
public string Email {
|
||||
get
|
||||
{
|
||||
return _email;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value.Contains("@"))
|
||||
{
|
||||
public string Email { get; set; } = null!;
|
||||
|
||||
_email =value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Celular { get; set; } = null!;
|
||||
|
||||
public Int64 Celular{get; set;}
|
||||
public string Domicilio { get; set; } = null!;
|
||||
|
||||
public string Domicilio {get; set;}
|
||||
private string _email;
|
||||
}
|
||||
public byte[]? Contrasena { get; set; }
|
||||
|
||||
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual ICollection<Grupo> Idgrupos { get; set; } = new List<Grupo>();
|
||||
}
|
||||
|
||||
25
Entidades/Propiedad.cs
Normal file
25
Entidades/Propiedad.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Propiedad
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public long? Dni { get; set; }
|
||||
|
||||
public string Ubicacion { get; set; } = null!;
|
||||
|
||||
public int? Canthabitaciones { get; set; }
|
||||
|
||||
public bool? Tienecocina { get; set; }
|
||||
|
||||
public int? Piso { get; set; }
|
||||
|
||||
public string? Letra { get; set; }
|
||||
|
||||
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual Propietario? DniNavigation { get; set; }
|
||||
}
|
||||
29
Entidades/Propietario.cs
Normal file
29
Entidades/Propietario.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Propietario
|
||||
{
|
||||
public long Dni { get; set; }
|
||||
|
||||
public long Cuil { get; set; }
|
||||
|
||||
public string Nombre { get; set; } = null!;
|
||||
|
||||
public string Apellido { get; set; } = null!;
|
||||
|
||||
public string Email { get; set; } = null!;
|
||||
|
||||
public string Celular { get; set; } = null!;
|
||||
|
||||
public string Domicilio { get; set; } = null!;
|
||||
|
||||
public byte[]? Contrasena { get; set; }
|
||||
|
||||
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual ICollection<Propiedad> Propiedades { get; set; } = new List<Propiedad>();
|
||||
|
||||
public virtual ICollection<Grupo> Idgrupos { get; set; } = new List<Grupo>();
|
||||
}
|
||||
15
Entidades/Recibo.cs
Normal file
15
Entidades/Recibo.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Recibo
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Mes { get; set; }
|
||||
|
||||
public decimal Monto { get; set; }
|
||||
|
||||
public virtual ICollection<Canon> Canons { get; set; } = new List<Canon>();
|
||||
}
|
||||
13
Entidades/Rol.cs
Normal file
13
Entidades/Rol.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Rol
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Descipcion { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Grupo> Idgrupos { get; set; } = new List<Grupo>();
|
||||
}
|
||||
11
Entidades/Servicio.cs
Normal file
11
Entidades/Servicio.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Servicio
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Descripcion { get; set; } = null!;
|
||||
}
|
||||
15
Entidades/ServicioPropiedade.cs
Normal file
15
Entidades/ServicioPropiedade.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class ServicioPropiedade
|
||||
{
|
||||
public int? Idpropiedad { get; set; }
|
||||
|
||||
public int? Idservicio { get; set; }
|
||||
|
||||
public virtual Propiedad? IdpropiedadNavigation { get; set; }
|
||||
|
||||
public virtual Servicio? IdservicioNavigation { get; set; }
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Modelo;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
36
Modelo/RepositorioBase.cs
Normal file
36
Modelo/RepositorioBase.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Entidades;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Modelo;
|
||||
|
||||
public abstract class RepositorioBase<T> where T : class, new()
|
||||
{
|
||||
private AlquilaFacilContext Context { get; set; } = new AlquilaFacilContext();
|
||||
|
||||
public void Add(T t){
|
||||
Context.Add(t);
|
||||
}
|
||||
public void Mod(T t){
|
||||
Context.Update(t);
|
||||
}
|
||||
public void Del(T t){
|
||||
|
||||
Context.Remove(t);
|
||||
}
|
||||
|
||||
public bool Guardar(){
|
||||
bool ret = false;
|
||||
try
|
||||
{
|
||||
Context.SaveChanges();
|
||||
Context.Dispose();
|
||||
Context = new AlquilaFacilContext();
|
||||
ret = true;
|
||||
} catch (DbUpdateException ex)
|
||||
{
|
||||
Console.Error.WriteLine(ex.Message);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user