Beispiel #1
0
        public void Post()
        {
            var munch = new MunchModel
            {
                PlayerName = "Kocham Alunię, bo jest śliczna! :*:*",
                LifeCount  = 1
            };

            client.PostAsync <MunchModel>(baseUrl, munch, formatter.First())
            .ContinueWith(PostAsyncTask())
            .Wait();
        }
Beispiel #2
0
        public void Get()
        {
            MunchModel munch = null;
            int        id    = 1;

            baseUrl += id.ToString();

            client.GetAsync(baseUrl)
            .ContinueWith(t =>
            {
                HttpResponseMessage response;

                response = t.Result;
                response.EnsureSuccessStatusCode();

                var readTask = response.Content.ReadAsAsync <MunchModel>();
                readTask.Wait();
                munch = readTask.Result;
            })
            .Wait();

            Assert.IsNotNull(munch);
        }
Beispiel #3
0
 public IEnumerable <MunchModel> AddMunch(MunchModel munch)
 {
     _db.Munches.Add(munch);
     _db.SaveChanges();
     return(_db.Munches);
 }
Beispiel #4
0
 // POST api/munch
 public HttpResponseMessage Post([FromBody] MunchModel munch)
 {
     return(_munchService.AddMunch(munch).PostResponseMessage(munch, Request));
 }