public IHttpActionResult GetLibaryEntity(int id) { using (LibraryEntities db = new LibraryEntities()) { var LibaryEntity = new LibraryEntityDTO(db.LibaryEntity.Include(x => x.Type).Include(x => x.Category).SingleOrDefault(x => x.ID == id)); return(Ok(LibaryEntity)); } }
public static LibraryEntityDTO GetAPIA(string path) { WebRequest request = WebRequest.Create(path); WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); StreamReader reader = new StreamReader(stream); LibraryEntityDTO model = JsonConvert.DeserializeObject <LibraryEntityDTO>(reader.ReadToEnd());; response.Close(); stream.Close(); reader.Close(); return(model); }