public async Task <OrderContent> Delete(OrderContent OrderContent)
        {
            if (!await OrderContentValidator.Delete(OrderContent))
            {
                return(OrderContent);
            }

            try
            {
                await UOW.Begin();

                await UOW.OrderContentRepository.Delete(OrderContent);

                await UOW.Commit();

                await Logging.CreateAuditLog(new { }, OrderContent, nameof(OrderContentService));

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

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

                if (ex.InnerException == null)
                {
                    throw new MessageException(ex);
                }
                else
                {
                    throw new MessageException(ex.InnerException);
                }
            }
        }
Beispiel #2
0
        public async Task <OrderContent> Delete(OrderContent OrderContent)
        {
            if (!await OrderContentValidator.Delete(OrderContent))
            {
                return(OrderContent);
            }

            try
            {
                await UOW.Begin();

                await UOW.OrderContentRepository.Delete(OrderContent);

                await UOW.Commit();

                await UOW.AuditLogRepository.Create("", OrderContent, nameof(OrderContentService));

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

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

                throw new MessageException(ex);
            }
        }