Exemple #1
0
        public async Task <Item> Update(Item Item)
        {
            if (!await ItemValidator.Update(Item))
            {
                return(Item);
            }
            try
            {
                var oldData = await UOW.ItemRepository.Get(Item.Id);

                await UOW.Begin();

                await UOW.ItemRepository.Update(Item);

                await UOW.Commit();

                var newData = await UOW.ItemRepository.Get(Item.Id);

                await UOW.AuditLogRepository.Create(newData, oldData, nameof(ItemService));

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

                await UOW.SystemLogRepository.Create(ex, nameof(ItemService));

                throw new MessageException(ex);
            }
        }