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

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

            return(animal);
        }
Exemplo n.º 3
0
        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));
        }