예제 #1
0
        /// <summary>
        /// Creates a new <see cref="AdminConcept"/>.
        /// </summary>
        /// <returns>Created <see cref="AdminConcept"/>.</returns>
        /// <param name="c"><see cref="AdminConcept"/>.</param>
        /// <exception cref="ArgumentException"/>
        /// <exception cref="LeafRPCException"/>
        /// <exception cref="DbException"/>
        public async Task <AdminConcept> CreateAsync(AdminConcept c)
        {
            ThrowIfInvalid(c);

            try
            {
                var created = await svc.CreateAsync(c);

                log.LogInformation("Created Concept. Concept:{@Concept}", created);
                return(created);
            }
            catch (DbException de)
            {
                log.LogError("Failed to create concept. Concept:{@Concept} Code:{Code} Error:{Error}", c, de.ErrorCode, de.Message);
                de.MapThrow();
                throw;
            }
        }
예제 #2
0
 void ThrowIfInvalid(AdminConcept c)
 {
     Ensure.NotNull(c, nameof(c));
 }