Exemplo n.º 1
0
        /// <summary>
        /// Método que obtiene un rol
        /// </summary>
        /// <param name="idRol">Id del role</param>
        /// <returns>Role</returns>
        public GEN_Rol ObtenerRol(int idRol)
        {
            var retorno = new GEN_Rol();

            try
            {
                retorno = _sisResEntities.GEN_Rol.Single(tc => tc.IdRol == idRol);
                _sisResEntities.Dispose();
                return(retorno);
            }
            catch (Exception)
            {
                return(retorno);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Método que almacena un rol
        /// </summary>
        /// <param name="rol">Datos del role</param>
        /// <returns>Id de ingreso</returns>
        public int CrearRol(GEN_Rol rol)
        {
            var idRetorno = 0;

            try
            {
                _sisResEntities.GEN_Rol.AddObject(rol);
                idRetorno = _sisResEntities.SaveChanges();
                _sisResEntities.Dispose();
                return(idRetorno);
            }
            catch (Exception)
            {
                return(idRetorno);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Método que actualiza un rol
        /// </summary>
        /// <param name="rol">Datos del rol</param>
        /// <returns>Id de actualización</returns>
        public int ActualizarRol(GEN_Rol rol)
        {
            var idRetorno = 0;

            try
            {
                _sisResEntities.GEN_Rol.Attach(rol);
                _sisResEntities.ObjectStateManager.ChangeObjectState(rol, EntityState.Modified);
                idRetorno = _sisResEntities.SaveChanges();
                _sisResEntities.Dispose();
                return(idRetorno);
            }
            catch (Exception)
            {
                return(idRetorno);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Método que actualiza un rol
 /// </summary>
 /// <param name="rol">Datos del rol</param>
 /// <returns>Id de actualización</returns>
 public int ActualizarRol(GEN_Rol rol)
 {
     return(new RolesDa().ActualizarRol(rol));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Método que almacena un rol
 /// </summary>
 /// <param name="rol">Datos del rol</param>
 /// <returns>Id de ingreso</returns>
 public int CrearRol(GEN_Rol rol)
 {
     return(new RolesDa().CrearRol(rol));
 }