public async Task <OrderContent> Create(OrderContent OrderContent) { if (!await OrderContentValidator.Create(OrderContent)) { return(OrderContent); } try { await UOW.Begin(); await UOW.OrderContentRepository.Create(OrderContent); await UOW.Commit(); await Logging.CreateAuditLog(OrderContent, new { }, nameof(OrderContentService)); return(await UOW.OrderContentRepository.Get(OrderContent.Id)); } 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); } } }
public async Task <OrderContent> Create(OrderContent OrderContent) { if (!await OrderContentValidator.Create(OrderContent)) { return(OrderContent); } try { await UOW.Begin(); await UOW.OrderContentRepository.Create(OrderContent); await UOW.Commit(); await UOW.AuditLogRepository.Create(OrderContent, "", nameof(OrderContentService)); return(await UOW.OrderContentRepository.Get(OrderContent.Id)); } catch (Exception ex) { await UOW.Rollback(); await UOW.SystemLogRepository.Create(ex, nameof(OrderContentService)); throw new MessageException(ex); } }