/// <summary>
        /// Integration test for SchoolbusownerhistoryGet
        /// </summary>
        public async void TestSchoolBusOwnerHistory()
        {
            // now create a school bus owner record

            var request = new HttpRequestMessage(HttpMethod.Post, "/api/schoolbusownerhistory");
            SchoolBusOwnerHistory schoolBusOwnerHistory = new SchoolBusOwnerHistory();

            var jsonString = schoolBusOwnerHistory.ToJson();

            request.Content = new StringContent(jsonString, Encoding.UTF8, "application/json");

            var response = await _client.SendAsync(request);

            response.EnsureSuccessStatusCode();

            // parse as JSON.
            jsonString = await response.Content.ReadAsStringAsync();

            schoolBusOwnerHistory = JsonConvert.DeserializeObject <SchoolBusOwnerHistory>(jsonString);
            // get the id
            var id = schoolBusOwnerHistory.Id;

            // now do an update.
            request         = new HttpRequestMessage(HttpMethod.Put, "/api/schoolbusownerhistory/" + id);
            request.Content = new StringContent(schoolBusOwnerHistory.ToJson(), Encoding.UTF8, "application/json");
            response        = await _client.SendAsync(request);

            response.EnsureSuccessStatusCode();

            // do a get.
            request  = new HttpRequestMessage(HttpMethod.Get, "/api/schoolbusownerhistory/" + id);
            response = await _client.SendAsync(request);

            response.EnsureSuccessStatusCode();

            // parse as JSON.
            jsonString = await response.Content.ReadAsStringAsync();

            schoolBusOwnerHistory = JsonConvert.DeserializeObject <SchoolBusOwnerHistory>(jsonString);

            // do a delete.
            request  = new HttpRequestMessage(HttpMethod.Post, "/api/schoolbusownerhistory/" + id + "/delete");
            response = await _client.SendAsync(request);

            response.EnsureSuccessStatusCode();

            // should get a 404 if we try a get now.
            request  = new HttpRequestMessage(HttpMethod.Get, "/api/schoolbusownerhistory/" + id);
            response = await _client.SendAsync(request);

            Assert.Equal(response.StatusCode, HttpStatusCode.NotFound);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>

        /// <param name="id">id of SchoolBusOwnerHistory to fetch</param>
        /// <response code="200">OK</response>
        /// <response code="404">SchoolBusOwnerHistory not found</response>

        public virtual IActionResult SchoolbusownerhistoryIdPutAsync(int id, SchoolBusOwnerHistory body)
        {
            var exists = _context.SchoolBusOwnerHistorys.Any(a => a.Id == id);

            if (exists && id == body.Id)
            {
                _context.SchoolBusOwnerHistorys.Update(body);
                // Save the changes
                _context.SaveChanges();
                return(new ObjectResult(body));
            }
            else
            {
                return(new StatusCodeResult(404));
            }
        }
 /// <summary>
 /// Setup the test.
 /// </summary>
 public SchoolBusOwnerHistoryModelTests()
 {
     instance = new SchoolBusOwnerHistory();
 }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>

        /// <param name="body"></param>
        /// <response code="201">SchoolBusOwnerHistory created</response>

        public virtual IActionResult SchoolbusownerhistoryPostAsync(SchoolBusOwnerHistory body)
        {
            _context.SchoolBusOwnerHistorys.Add(body);
            _context.SaveChanges();
            return(new ObjectResult(body));
        }
Esempio n. 5
0
 public virtual IActionResult SchoolbusownerhistoryPost([FromBody] SchoolBusOwnerHistory item)
 {
     return(this._service.SchoolbusownerhistoryPostAsync(item));
 }
Esempio n. 6
0
 public virtual IActionResult SchoolbusownerhistoryIdPut([FromRoute] int id, [FromBody] SchoolBusOwnerHistory item)
 {
     return(this._service.SchoolbusownerhistoryIdPutAsync(id, item));
 }