public async Task <int> Handle(CreateGestionRiesgoCommand request, CancellationToken cancellationToken)
            {
                var entity = new TGestionRiesgo();

                entity.CodGestionRiesgo      = request.CodGestionRiesgo;
                entity.CodGestionRiesgoPadre = request.CodGestionRiesgoPadre;
                entity.Descripcion           = request.Descripcion;

                _context.TGestionRiesgo.Add(entity);

                await _context.SaveChangesAsync(cancellationToken);

                return(int.Parse(entity.CodGestionRiesgo));
            }
Esempio n. 2
0
            public GestionRiesgoNodeVM recursion(TGestionRiesgo it)
            {
                var ubicacionPadre = new GestionRiesgoNodeVM();

                ubicacionPadre.Codigo          = it.CodGestionRiesgo;
                ubicacionPadre.Descripcion     = it.Descripcion;
                ubicacionPadre.DetalleAsociado = it.DetalleAsociado;
                if (it.Hijos.Count == 0)
                {
                    return(ubicacionPadre);
                }


                if (it.Hijos.Count > 0)
                {
                    foreach (var hijos in it.Hijos)
                    {
                        ubicacionPadre.children.Add(recursion(hijos));
                    }
                }
                return(ubicacionPadre);
            }