This commit is contained in:
mumana 2018-06-15 15:36:31 +00:00
parent 7fa43982b6
commit 7206edbdec
2 changed files with 21 additions and 2 deletions

View file

@ -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)
{

View file

@ -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);