Exemple #1
0
        public async Task <JObject> CreateItemAsync(TasksModel modelObject, string requestId = "")
        {
            _logger.LogInformation($"RequestId: {requestId} - Tasks_CreateItemAsync called.");

            Guard.Against.Null(modelObject, nameof(modelObject), requestId);
            Guard.Against.NullOrEmpty(modelObject.Name, nameof(modelObject.Name), requestId);
            try
            {
                var entityObject = MapToEntity(modelObject, requestId);

                return(await _tasksRepository.CreateItemAsync(entityObject, requestId));
            }
            catch (Exception ex)
            {
                _logger.LogError($"RequestId: {requestId} - Tasks_CreateItemAsync Service Exception: {ex}");
                throw new ResponseException($"RequestId: {requestId} - Tasks_CreateItemAsync Service Exception: {ex}");
            }
        }