public override async Task <RandomSequenceModel> AddAsync(RandomSequenceModel modelToAdd) { var domainToAdd = Mapper.Map <RandomSequenceModel, RandomSequence>(modelToAdd); return(await ExecuteOperation(domainToAdd, item => { item.Id = item.Id.IsEmptyGuid() ? IdService.GenerateId() : item.Id; item.DateInserted = Clock.UtcNow(); item.LastModifiedBy = Environment.UserName; return item; }, item => Repository.AddAsync(item)) .ConfigureAwait(false)); }
public Task <RandomSequenceModel> GenerateRandomSequence() { return(Task.Run(async() => { try { return new RandomSequenceModel { Id = IdService.GenerateId(), RandomSequence = randomSequenceGeneratorService.ThirdGenerateRandomSequenceMethod(), }; } catch (Exception exception) { await LogExceptionAsync(exception.Message, exception); return default; } })); }