Пример #1
0
        /// <summary>
        /// Gets Person information
        /// </summary>
        /// <param name="id">ID of the Person</param>
        /// <param name="person">Person instance to be populated</param>
        /// <param name="settings">Object containing Data Fetch settings</param>
        /// <returns>Person instance containing retreived information</returns>
        public Person GetPerson(long id, Person person, PersonDataFetchSettings settings)
        {
            GetPersonDetailsRequest request = new GetPersonDetailsRequest {
                ID = id, Settings = settings
            };
            GetPersonDetailsResponse response = jmAppClientProvider.CallAction <GetPersonDetailsResponse>(ActionNameConstants.GetPersonDetails, request);

            return(response.Person);
        }
        public void Initialize()
        {
            StaticDataManagementRequest request = new StaticDataManagementRequest();

            request.StaticDataProviderType = typeof(T);
            StaticDataManagementResponse response = jmAppClientProvider.CallAction <StaticDataManagementResponse>(ActionNameConstants.StaticDataManagement, request);

            HandleStaticDataResponse(response);
        }
Пример #3
0
        public ActionResult Get(long id, int w, int h)
        {
            GetImageContentsRequest request = new GetImageContentsRequest {
                ID = id
            };
            GetImageContentsResponse response = jmAppClientProvider.CallAction <GetImageContentsResponse>(ActionNameConstants.GetImageContents, request);

            if (response.Image == null)
            {
                return(StatusCode(StatusCodes.Status404NotFound));
            }
            else
            {
                if (w != default(int) || h != default(int))
                {
                    using (Image image = Image.Load(response.Image.Content))
                    {
                        if (w != default(int))
                        {
                            h = (int)((double)image.Height / (double)image.Width * (double)w);
                        }
                        else
                        {
                            w = (int)((double)image.Width / (double)image.Height * (double)h);
                        }
                        ResizeOptions resizeOptions = new ResizeOptions
                        {
                            Size = new Size
                            {
                                Width  = w,
                                Height = h
                            }
                        };

                        using (MemoryStream stream = new MemoryStream())
                        {
                            image.Mutate(e => e.Resize(resizeOptions));
                            image.Save(stream, new JpegEncoder());
                            return(new FileContentResult(stream.ToArray(), "image/jpeg"));
                        }
                    }
                }
                else
                {
                    string extension = Path.GetExtension(response.Image.URL).TrimStart('.');
                    if (extension == "jpg")
                    {
                        extension = "jpeg";
                    }
                    string mimeType = "image/" + extension;
                    return(new FileContentResult(response.Image.Content, mimeType));
                }
            }
        }
Пример #4
0
        public BaseResponse Post(string actionName, [FromBody] JToken jsonBody)
        {
            FlowConfiguration flowConfiguration = flowConfigurationProvider.GetConfiguration(actionName);

            if (flowConfiguration == null)
            {
                throw new JMException("FlowConfigurationEmpty");
            }
            BaseRequest request = jsonBody.ToObject(Type.GetType(flowConfiguration.RequestIdentifier)) as BaseRequest;

            return(jmAppClientProvider.CallAction <BaseResponse>(actionName, request));
        }
 public LoginResponse Authenticate(LoginRequest request)
 {
     return(jmAppClientProvider.CallAction <LoginResponse>(ActionNameConstants.Login, request));
 }