private User parseUser(HttpListenerRequest request)
        {
            string userAsJson = RequestBodyParser.parse(request.InputStream, request.ContentEncoding);
            User   user       = JsonConvert.DeserializeObject <User>(userAsJson);

            return(user);
        }
示例#2
0
        private Animal parseAnimal(HttpListenerRequest request)
        {
            string animalAsJson = RequestBodyParser.parse(request.InputStream, request.ContentEncoding);
            Animal animal       = JsonConvert.DeserializeObject <Animal>(animalAsJson);

            return(animal);
        }
        public Responce setAnimalOnUser(HttpListenerRequest request)
        {
            string animalAsString = RequestBodyParser.parse(request.InputStream, request.ContentEncoding);
            Animal animal         = JsonConvert.DeserializeObject <Animal>(animalAsString);

            User user = userRepository.setAnimalOnUser(Int32.Parse(request.QueryString["userId"]), animal);

            return(Responce.ok((UserPlane)user));
        }