Beispiel #1
0
        public async Task <Result> SaveAsync(MetaData metaData, string username)
        {
            metaData.Audit(username);

            var result = _validator.Validate(metaData);

            if (result.IsValid)
            {
                try
                {
                    metaData.Id = result.NewId = await _metaDataAccess.SaveAsync(metaData, metaData.IsNew?DataAccessActions.Insert : DataAccessActions.Update);
                }
                catch (Exception ex)
                {
                    _logger.LogError($"SaveAsync error: {ex.Message}, stack: {ex.StackTrace}");
                    result.Errors.Add(new ErrorItem(ex.Message));
                }
            }

            return(result);
        }