/// <summary> /// Posts a new comment. /// </summary> /// <param name="item">New comment</param> /// <returns>Status message</returns> public async Task<Comment> Post(Comment item) { if (item == null) { throw new HttpResponseException( Request.CreateErrorResponse(HttpStatusCode.NotFound, "Invalid parameter")); } var comment = await repository.InsertAsync(item); return comment; }
/// <summary> /// Updates an existing comment. /// </summary> /// <param name="key">Comment ID</param> /// <param name="item">Updated comment</param> /// <returns>Status message</returns> public async Task<Comment> Put([FromODataUri] Guid key, Comment item) { if (key == Guid.Empty || item == null) { throw new HttpResponseException( Request.CreateErrorResponse(HttpStatusCode.NotFound, "Invalid parameter")); } item.ID = key; var comment = await repository.UpdateAsync(item); return comment; }