git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C53
This commit is contained in:
parent
7fa43982b6
commit
7206edbdec
2 changed files with 21 additions and 2 deletions
|
|
@ -43,8 +43,27 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
|||
{
|
||||
using (SinortContex db = new SinortContex())
|
||||
{
|
||||
|
||||
if (model == null && !string.IsNullOrWhiteSpace(model.codigo))
|
||||
{
|
||||
if (!db.RolesPantallas.Any(r => r.IdRol.ToString() == model.codigo))
|
||||
{
|
||||
var ListaPantallas = db.Pantallas.ToList();
|
||||
var dal = new RolesDAL();
|
||||
|
||||
foreach (var pantalla in ListaPantallas)
|
||||
dal.InsertarActualizarRolesPantallas(new RolesPantallas()
|
||||
{
|
||||
IdRol = Convert.ToInt32(model.codigo),
|
||||
IdPantalla = pantalla.IdPantalla,
|
||||
Estado = false
|
||||
});
|
||||
}
|
||||
|
||||
registros = db.RolesPantallas.Where(r => r.IdRol.ToString() == model.codigo).Include(p => p.Pantallas).AsNoTracking().ToList();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
|||
|
||||
using (SinortContex Conn = new SinortContex())
|
||||
{
|
||||
Actual = Conn.RolesPantallas.Where(x => x.IdRolesPantallas == model.IdRolesPantallas ).FirstOrDefault();
|
||||
Actual = Conn.RolesPantallas.FirstOrDefault(x => x.IdRolesPantallas == model.IdRolesPantallas );
|
||||
if (Actual == null)
|
||||
{
|
||||
int? Next_id = Conn.RolesPantallas.Max(t => (int?)t.IdRolesPantallas);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue