public HttpResponseMessage GetDriverByID(string vendorkey) { Data.vendor vendor = repo.GetbyId(Guid.Parse(vendorkey)); VendorBO vendorBO = new VendorBO(); if (vendor != null) { vendorBO.vendid = vendor.vendid; vendorBO.vendkey = vendor.vendkey; vendorBO.vendname = vendor.vendname; vendorBO.status = vendor.status; vendorBO.statusdate = vendor.statusdate; var address = new AddressRepository().GetbyId(vendor.addrkey); if (address != null) { vendorBO.Address = new AddressBO() { AddrKey = address.addrkey, Address1 = address.address1, Address2 = address.address2, City = address.city, State = address.state, Zip = address.zipcode, Email = address.email, Phone = address.phone, Fax = address.fax, Website = address.website, Country = address.country }; } return(Request.CreateResponse(HttpStatusCode.OK, vendorBO, Configuration.Formatters.JsonFormatter)); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Not found", Configuration.Formatters.JsonFormatter)); } }