[OperationContract] [WebGet(UriTemplate = "Patient/{id}")] Patient GetPatient(string id);
public Patient GetPatient(string id) { try { int patientId = Convert.ToInt32(id); using (var db = new PatientInformationEntities()) { return db.Patients.SingleOrDefault(p => p.Id == patientId); } } catch (Exception ex) { throw new FaultException(ex.Message); } }
WebClient Client = new WebClient(); string path = "http://localhost:8080/PatientService/"; string Result = null; switch (OpCode) { case 1 : Console.WriteLine("Enter Patient Id"); string id = Console.ReadLine(); string GetPatient =path + "Patient/" + id; byte[] abc = Client.DownloadData((new Uri( GetPatient))); Stream stream = new MemoryStream(abc); DataContractSerializer obj = new DataContractSerializer(typeof(String)); var X = obj.ReadObject(stream).ToString(); Console.WriteLine(); Console.WriteLine(); Console.ReadLine(); break; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)