コード例 #1
0
        public void Delete_Ok_Test()
        {
            var reservation = _context.Reservations.Take(10).ToList().Last();

            _reservationOperations.DeleteAsync(reservation.Id).Wait();

            using (var cntxt = new HobbyContext())
            {
                Assert.IsNull(cntxt.Reservations.Find(reservation.Id));
            }
        }
コード例 #2
0
        public async Task <IHttpActionResult> Delete(int id)
        {
            try
            {
                var reservation = await _reservationOperations.GetAsync(id);

                if (reservation == null)
                {
                    return(this.Result404("This reservation is not found"));
                }

                await _reservationOperations.DeleteAsync(id);

                return(Ok("Deleted"));
            }
            catch (Exception ex)
            {
                ErrorLogger.Log("CANNOT DELETE RESERVATION", ex);
                throw;
            }
        }