/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { UpdateMethodResponse response = new UpdateMethodResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("apiKeyRequired", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.ApiKeyRequired = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("authorizationType", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.AuthorizationType = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("httpMethod", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.HttpMethod = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("methodIntegration", targetDepth)) { var unmarshaller = IntegrationUnmarshaller.Instance; response.MethodIntegration = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("methodResponses", targetDepth)) { var unmarshaller = new DictionaryUnmarshaller <string, MethodResponse, StringUnmarshaller, MethodResponseUnmarshaller>(StringUnmarshaller.Instance, MethodResponseUnmarshaller.Instance); response.MethodResponses = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("requestModels", targetDepth)) { var unmarshaller = new DictionaryUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance); response.RequestModels = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("requestParameters", targetDepth)) { var unmarshaller = new DictionaryUnmarshaller <string, bool, StringUnmarshaller, BoolUnmarshaller>(StringUnmarshaller.Instance, BoolUnmarshaller.Instance); response.RequestParameters = unmarshaller.Unmarshall(context); continue; } } return(response); }
public UpdateMethodResponse Update(UpdateMethodRequest request) { var response = new UpdateMethodResponse(); try { var method = request.MapTo <Method>(); DataContext.Methods.Attach(method); DataContext.Entry(method).State = EntityState.Modified; DataContext.SaveChanges(); response.IsSuccess = true; response.Message = "Method item has been updated successfully"; } catch (DbUpdateException dbUpdateException) { response.Message = dbUpdateException.Message; } return(response); }
public UpdateMethodResponse Update(UpdateMethodRequest request) { var response = new UpdateMethodResponse(); try { var method = request.MapTo<Method>(); DataContext.Methods.Attach(method); DataContext.Entry(method).State = EntityState.Modified; DataContext.SaveChanges(); response.IsSuccess = true; response.Message = "Method item has been updated successfully"; } catch (DbUpdateException dbUpdateException) { response.Message = dbUpdateException.Message; } return response; }