Exemple #1
0
        /// <summary>
        /// Integration test for SchoolbusownernotesGet
        /// </summary>
        public async void TestSchoolbusOwnerNotes()
        {
            // now create a school bus owner record

            var request = new HttpRequestMessage(HttpMethod.Post, "/api/schoolbusownernotes");
            SchoolBusOwnerNote schoolBusOwnerNote = new SchoolBusOwnerNote();

            var jsonString = schoolBusOwnerNote.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();

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

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

            response.EnsureSuccessStatusCode();

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

            response.EnsureSuccessStatusCode();

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

            schoolBusOwnerNote = JsonConvert.DeserializeObject <SchoolBusOwnerNote>(jsonString);

            // do a delete.
            request  = new HttpRequestMessage(HttpMethod.Post, "/api/schoolbusownernotes/" + 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/schoolbusownernotes/" + id);
            response = await _client.SendAsync(request);

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

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

        public virtual IActionResult SchoolbusownernotesIdPutAsync(int id, SchoolBusOwnerNote body)
        {
            var exists = _context.SchoolBusOwnerNotes.Any(a => a.Id == id);

            if (exists && id == body.Id)
            {
                _context.SchoolBusOwnerNotes.Update(body);
                // Save the changes
                _context.SaveChanges();
                return(new ObjectResult(body));
            }
            else
            {
                return(new StatusCodeResult(404));
            }
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>

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

        public virtual IActionResult SchoolbusownernotesPostAsync(SchoolBusOwnerNote body)
        {
            _context.SchoolBusOwnerNotes.Add(body);
            _context.SaveChanges();
            return(new ObjectResult(body));
        }
Exemple #4
0
 public virtual IActionResult SchoolbusownernotesPost([FromBody] SchoolBusOwnerNote item)
 {
     return(this._service.SchoolbusownernotesPostAsync(item));
 }
Exemple #5
0
 public virtual IActionResult SchoolbusownernotesIdPut([FromRoute] int id, [FromBody] SchoolBusOwnerNote item)
 {
     return(this._service.SchoolbusownernotesIdPutAsync(id, item));
 }
Exemple #6
0
 /// <summary>
 /// Setup the test.
 /// </summary>
 public SchoolBusOwnerNoteModelTests()
 {
     instance = new SchoolBusOwnerNote();
 }