Пример #1
0
        public async Task <Reservation> Delete(Reservation Reservation)
        {
            if (!await ReservationValidator.Delete(Reservation))
            {
                return(Reservation);
            }

            try
            {
                await UOW.Begin();

                await UOW.ReservationRepository.Delete(Reservation);

                await UOW.Commit();

                await Logging.CreateAuditLog(new { }, Reservation, nameof(ReservationService));

                return(Reservation);
            }
            catch (Exception ex)
            {
                await UOW.Rollback();

                await Logging.CreateSystemLog(ex.InnerException, nameof(ReservationService));

                if (ex.InnerException == null)
                {
                    throw new MessageException(ex);
                }
                else
                {
                    throw new MessageException(ex.InnerException);
                }
            }
        }