Пример #1
0
        public bool Modificar(Rol rol)
        {
            bool updated = false;

            try
            {
                DAL.DTO.Rol rolDal = Converter.ConvertToDAL(rol);

                RolDAL mod = new RolDAL(_connectionString);

                updated = mod.Modificar(rolDal);


                if (updated)
                {
                    // Si había una caché para prensa la borramos
                    string nombreCache = string.Format("rol{0}", rol.rol);
                    CacheData.Remove(nombreCache);
                }
            }
            catch (Exception er)
            {
                log.Error("Agregar()", er);
            }

            return(updated);
        }
Пример #2
0
        internal static DAL.DTO.Rol ConvertToDAL(DTO.Rol item)
        {
            DAL.DTO.Rol rol = null;

            if (item != null)
            {
                rol = new DAL.DTO.Rol
                {
                    Id     = (int)item.rol,
                    Nombre = item.Nombre,
                };
            }
            return(rol);
        }
Пример #3
0
        internal static DTO.Rol ConvertToBL(DAL.DTO.Rol item)
        {
            DTO.Rol rol = null;

            if (item != null)
            {
                rol = new DTO.Rol
                {
                    rol    = (Model.BL.DTO.Enums.Tipo_Rol)Enum.Parse(typeof(Model.BL.DTO.Enums.Tipo_Rol), item.Id.ToString()),
                    Nombre = item.Nombre,
                };
            }
            return(rol);
        }