public SchoolModel GetById(int id)
 {
     var responseMsg = this.PerformOperationAndHandleExceptions(() =>
     {
         var result = new SchoolModel();
         var db = new SchoolContext();
         var school = db.Schools.Find(id);
         if (school != null)
         {
             result.Id = school.Id;
             result.Location = school.Location;
             result.Name = school.Name;
         }
         return result;
     });
     return responseMsg;
 }
        public HttpResponseMessage Post(SchoolModel school)
        {
            var responseMsg = this.PerformOperationAndHandleExceptions(() =>
            {
                var newcSchool = new School()
                {
                    Location = school.Location,
                    Name = school.Name
                };
                var db = new SchoolContext();
                db.Schools.Add(newcSchool);
                db.SaveChanges();

                school.Id = newcSchool.Id;
                var response = this.Request.CreateResponse(HttpStatusCode.Created, school);
                return response;
            });
            return responseMsg;
        }
        public void PostTest()
        {
            SchoolModel school = new SchoolModel()
            {
                Location = "bg",
                Name = "lelq vachka"
            };

            var httpServer = new InMemoryHttpServer("http://localhost:4728/");
            var response = httpServer.CreatePostRequest("api/school", school);

            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
            Assert.IsNotNull(response.Content);

            var contentString = response.Content.ReadAsStringAsync().Result;
            var model = JsonConvert.DeserializeObject<SchoolModel>(contentString);

            Assert.IsTrue(model.Id > 0);
        }