Пример #1
0
        public async Task <ActionResult> DeletePassenger(int id)
        {
            try
            {
                var oldpassenger = await _passengerRepository.GetPassengerById(id);

                if (oldpassenger == null)
                {
                    return(NotFound($"there is no pasenger with id:{id}"));
                }

                _passengerRepository.Delete(oldpassenger);

                if (await _passengerRepository.Save())
                {
                    return(NoContent());
                }
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure:{e.Message}"));
            }
            return(BadRequest());
        }
Пример #2
0
 public void Delete(int id)
 {
     _passengerRepository.Delete(id);
 }