public ActionResult Product(int id) { ViewServiceClient db = new ViewServiceClient(); List <product> product = db.Get_product(0).ToList(); return(View(product.Where(m => m.product_cate_id == id))); }
public ActionResult Product(int id) { ViewServiceClient db = new ViewServiceClient(); var litem = db.Get_product(0); if (litem == null) { return(View()); } List <product> product = litem.ToList(); return(View(product.Where(m => m.product_cate_id == id))); }
public RemoteSharer(string host) { this.proxy = RemoteContext.Instance.GetProxy(host); }
private void ViewServiceHostConnected(object sender, HostConnectedEventArgs e) { this.OnHostConnected(e); if (e.Accepted) { var address = new EndpointAddress(string.Format(ViewServiceHost.BASE_ADDRESS, e.Ip, ViewServiceHost.PORT)); var proxy = new ViewServiceClient(address); this.connectedHosts.TryAdd(e.Ip, proxy); } }
public async Task<bool> ConnectAsync(SharingEndpoint endpoint) { var ip = IpHelper.GetIp(endpoint.Address.Uri.Host); if (this.connectedHosts.ContainsKey(ip)) return true; var proxy = new ViewServiceClient(endpoint.Address); var result = await Task.Factory.StartNew<bool>(proxy.Connect); if (result) this.connectedHosts.TryAdd(ip, proxy); return result; }
public async Task<IEnumerable<RemoteHost>> FindClientsAsync() { var hosts = new List<RemoteHost>(); using (var client = new ViewServiceClient()) { foreach (var endpoint in await client.DiscoverAsync()) { #if !DEBUG if (!endpoint.Address.Uri.IsLoopback) // enable local testing #endif hosts.Add(new RemoteHost { Ip = IpHelper.GetIp(endpoint.Address.Uri.Host), Name = endpoint.Name }); } } return hosts; }
public IEnumerable<RemoteHost> FindClients() { using (var client = new ViewServiceClient()) { foreach (var endpoint in client.Discover()) { #if !DEBUG if (!endpoint.Address.IsLoopback) // enable local testing #endif yield return new RemoteHost { Ip = IpHelper.GetIp(endpoint.Address.Uri.Host), Name = endpoint.Name }; } } }