Ejemplo n.º 1
0
        public async Task <Item> Create(Item Item)
        {
            if (!await ItemValidator.Create(Item))
            {
                return(Item);
            }

            try
            {
                await UOW.Begin();

                await UOW.ItemRepository.Create(Item);

                await UOW.Commit();

                await UOW.AuditLogRepository.Create(Item, "", nameof(ItemService));

                return(await UOW.ItemRepository.Get(Item.Id));
            }
            catch (Exception ex)
            {
                await UOW.Rollback();

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

                throw new MessageException(ex);
            }
        }