/// <summary> /// Handles POST requests that create new entities in the entity set. /// </summary> /// <param name="entity">The entity to insert into the entity set.</param> /// <returns>The response message to send back to the client.</returns> public virtual HttpResponseMessage Post([FromBody] TEntity entity) { TEntity createdEntity = CreateEntity(entity); TKey entityKey = GetKey(entity); return(EntitySetControllerHelpers.PostResponse(this, createdEntity, entityKey)); }
/// <summary> /// Handles POST requests that create new entities in the entity set. /// </summary> /// <param name="entity">The entity to insert into the entity set.</param> /// <returns>A <see cref="Task"/> that contains the response message to send back to the client when it completes.</returns> public virtual async Task <HttpResponseMessage> Post([FromBody] TEntity entity) { TEntity createdEntity = await CreateEntityAsync(entity); return(EntitySetControllerHelpers.PostResponse <TEntity, TKey>(this, createdEntity, GetKey(createdEntity))); }