FEAT: hecho el arreglo de los botones y empecé con el registro de propiedades
This commit is contained in:
@@ -19,9 +19,9 @@ public class RepositorioGrupos: RepositorioBase<RepositorioGrupos> {
|
||||
return Guardar(con);
|
||||
}
|
||||
|
||||
public object? Listar()
|
||||
{
|
||||
return Context.Grupos.Include(x => x.Idpermisos);
|
||||
public IQueryable<Permiso> ListarPermisosDeGrupo(string grupo) {
|
||||
var con = Context;
|
||||
return con.Grupos.Where(x=>x.Nombre == grupo).SelectMany(x => x.Idpermisos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -76,7 +77,8 @@ public class RepositorioPropiedades: RepositorioBase<RepositorioPropiedades>
|
||||
|
||||
public bool BajaPropiedad(int id) {
|
||||
var con = Context;
|
||||
Propiedade prop = con.Propiedades.Find(id);
|
||||
Propiedade? prop = con.Propiedades.Find(id);
|
||||
if (prop == null) return false;
|
||||
prop.Idestado = 3;
|
||||
|
||||
return Guardar(con);
|
||||
|
||||
@@ -2,7 +2,8 @@ using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Entidades.Dto;
|
||||
using Entidades;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Modelo;
|
||||
|
||||
public class RepositorioUsuarios: RepositorioBase<RepositorioUsuarios> {
|
||||
@@ -102,5 +103,20 @@ public class RepositorioUsuarios: RepositorioBase<RepositorioUsuarios> {
|
||||
Guardar(con);
|
||||
}
|
||||
|
||||
public bool CheckGrupo(string email, string grupo) {
|
||||
var con = Context;
|
||||
var usu = con.Clientes.Include(x=>x.Idgrupos).FirstOrDefault(x=>x.Email == email);
|
||||
bool ret = false;
|
||||
|
||||
if (usu != null && usu.Idgrupos != null) {
|
||||
Parallel.ForEach(usu.Idgrupos, (idGrupo, state) => {
|
||||
if (idGrupo.Nombre == grupo) {
|
||||
ret = true;
|
||||
state.Break();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user