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)); }
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")); }
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")); }