/** * Método para crear nuevo registro */ public static void insert(String name, List <modules> modules) { using (var conn = new db_entities()) { try { conn.SP_ROL_INSERT(name, DateTime.Now, 1); var entity = conn.roles.Where(x => x.name == name).FirstOrDefault(); if (modules != null) { foreach (modules item in modules) { conn.SP_ROL_MODULE_INSERT(entity.id, item.id); } } } catch (Exception e) { throw e; } } }