Beispiel #1
0
        public async Task <IActionResult> Index()
        {
            var channel = GrpcChannel.ForAddress("https://localhost:5001");
            var client  = new UsuarioGRUD.UsuarioGRUDClient(channel);
            var reply   = await client.SelectAllAsync(new Empty());

            return(View(reply));
        }
Beispiel #2
0
        public async Task <IActionResult> Modificar(UsuarioProto usuario)
        {
            if (!ModelState.IsValid)
            {
                return(View(usuario));
            }
            var channel = GrpcChannel.ForAddress("https://localhost:5001");
            var client  = new UsuarioGRUD.UsuarioGRUDClient(channel);
            await client.UpdateAsync(usuario);

            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public async Task <IActionResult> Eliminar(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index"));
            }
            var channel = GrpcChannel.ForAddress("https://localhost:5001");
            var client  = new UsuarioGRUD.UsuarioGRUDClient(channel);
            await client.DeleteAsync(new UsuarioProtoFilter()
            {
                UsuarioID = Convert.ToInt32(id)
            });

            return(RedirectToAction("Index"));
        }