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

            try
            {
                await UOW.Begin();

                await UOW.TableRepository.Create(Table);

                await UOW.Commit();

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

                return(await UOW.TableRepository.Get(Table.Id));
            }
            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);
                }
            }
        }