Example #1
0
        public async Task <Table> Delete(Table Table)
        {
            if (!await TableValidator.Delete(Table))
            {
                return(Table);
            }

            try
            {
                await UOW.Begin();

                await UOW.TableRepository.Delete(Table);

                await UOW.Commit();

                await Logging.CreateAuditLog(new { }, Table, nameof(TableService));

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

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

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