Feat: commit antes de mostrar el codigo.
- Añadido alta propiedad - Arreglado alta inq/prop - Añadida pantalla de menu
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Data;
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Modelo;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
public class RepositorioPropiedades: RepositorioBase<RepositorioPropiedades>
|
||||
{
|
||||
@@ -36,18 +37,35 @@ public class RepositorioPropiedades: RepositorioBase<RepositorioPropiedades>
|
||||
return prop;
|
||||
}
|
||||
|
||||
public bool AñadirPropiedad(Propiedade? prop){
|
||||
if (prop == null) return false;
|
||||
|
||||
var con = Context;
|
||||
|
||||
int count = con.Propiedades.Count()+1;
|
||||
public bool AñadirPropiedad(Propiedade? prop) {
|
||||
if (prop == null) return false;
|
||||
|
||||
prop.Id = count;
|
||||
prop.Idestado = 1;
|
||||
con.Propiedades.Add(prop);
|
||||
return Guardar(con);
|
||||
}
|
||||
var con = Context;
|
||||
|
||||
if (string.IsNullOrEmpty(prop.Letra)) prop.Letra = "_";
|
||||
|
||||
var filasInsertadasParam = new MySqlParameter("@p_filas_insertadas", SqlDbType.Int)
|
||||
{
|
||||
Direction = ParameterDirection.Output
|
||||
};
|
||||
|
||||
// Ejecutar el procedimiento almacenado
|
||||
var row = con.Database.ExecuteSqlRaw(
|
||||
$"""
|
||||
CALL InsertarPropiedad(@p_ubicacion, @p_cant_habitaciones, @p_piso, @p_letra,
|
||||
@p_dni_propietario, @p_id_tipo_propiedad, @p_filas_insertadas)
|
||||
""",
|
||||
new MySqlParameter("@p_ubicacion", prop.Ubicacion),
|
||||
new MySqlParameter("@p_cant_habitaciones", prop.Canthabitaciones),
|
||||
new MySqlParameter("@p_piso", prop.Piso),
|
||||
new MySqlParameter("@p_letra", prop.Letra),
|
||||
new MySqlParameter("@p_dni_propietario", prop.Dnipropietario),
|
||||
new MySqlParameter("@p_id_tipo_propiedad", prop.Idtipropiedad),
|
||||
filasInsertadasParam
|
||||
);
|
||||
|
||||
return (int)filasInsertadasParam.Value == 1? true: false;
|
||||
}
|
||||
|
||||
public IQueryable<PropiedadesDto> ObtenerPropiedadesPorEmail(string email) {
|
||||
FormattableString sqlq = $"""
|
||||
|
||||
Reference in New Issue
Block a user