[OperationContract] [WebGet(UriTemplate = "GetBookById/?id={id}", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] Book GetBookById(string id); public Book GetBookById(string id) { try { int bookId = Convert.ToInt32(id); using (SAMPLEDBEntities entities = new SAMPLEDBEntities()) { return entities.Books.SingleOrDefault(book => book.ID == bookId); } } catch { throw new FaultException("Something went wrong"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)