Example #1
0
        public async Task <Table> Update(Table Table)
        {
            if (!await TableValidator.Update(Table))
            {
                return(Table);
            }
            try
            {
                var oldData = await UOW.TableRepository.Get(Table.Id);

                await UOW.Begin();

                await UOW.TableRepository.Update(Table);

                await UOW.Commit();

                var newData = await UOW.TableRepository.Get(Table.Id);

                await Logging.CreateAuditLog(newData, oldData, nameof(TableService));

                return(newData);
            }
            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);
                }
            }
        }