Inheritance: LtiLibrary.Core.Common.JsonLdObject
Ejemplo n.º 1
0
 public PostResultContext(string contextId, string lineItemId, LisResult result)
 {
     ContextId = contextId;
     LineItemId = lineItemId;
     Result = result;
     StatusCode = HttpStatusCode.OK;
 }
Ejemplo n.º 2
0
        public async Task<HttpResponseMessage> Put(string contextId, string lineItemId, string id, LisResult result)
        {
            try
            {
                var context = new PutResultContext(contextId, lineItemId, id, result);

                await OnPutResult(context);

                return Request.CreateResponse(context.StatusCode);
            }
            catch (Exception ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex);
            }
        }
Ejemplo n.º 3
0
        public async Task<HttpResponseMessage> Post(string contextId, string lineItemId, LisResult result)
        {
            try
            {
                var context = new PostResultContext(contextId, lineItemId, result);

                await OnPostResult(context);

                return context.StatusCode == HttpStatusCode.Created
                    ? Request.CreateResponse(context.StatusCode, context.Result, new ResultFormatter())
                    : Request.CreateResponse(context.StatusCode);
            }
            catch (Exception ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Update a particular LISResult instance within the server.
 /// </summary>
 /// <param name="result">The LISResult to be updated within the server.</param>
 /// <param name="serviceUrl">The LISResult REST endpoint.</param>
 /// <param name="consumerKey">The OAuth consumer key to use to form the Authorization header.</param>
 /// <param name="consumerSecret">The OAuth consumer secret to use to form the Authorization header.</param>
 /// <returns>No content is returned.</returns>
 public static async Task <OutcomeResponse> PutResult(LisResult result, string serviceUrl, string consumerKey, string consumerSecret)
 {
     return(await PutOutcome(result, serviceUrl, consumerKey, consumerSecret, LtiConstants.LisResultMediaType));
 }