Пример #1
0
        public void AddDeparture_When_correct_data_Then_count_equal_1()
        {
            //assign
            DepartureDTO departure = new DepartureDTO()
            {
                FlightNumber  = 1,
                DepartureTime = new DateTime(2018, 2, 2),
                IdAircraft    = 1,
                IdCrew        = 1
            };

            //act
            departureService.AddDeparture(departure);

            //assert
            Assert.That(Departures.Count == 1);
        }
Пример #2
0
 public JsonResult Post([FromBody] DepartureDTO departure)
 {
     try
     {
         return(Json(departureService.AddDeparture(departure)));
     }
     catch (System.Exception ex)
     {
         HttpContext.Response.StatusCode = 400;
         return(Json(ex.Message));
     }
 }