Esempio n. 1
0
        private static FormInfo CreateFormInfo(Uri baseUri, Form form)
        {
            if (form == null)
            {
                return null;
            }

            var resourceUri = form.Resource.IsAbsoluteUri ? form.Resource : new Uri(baseUri, form.Resource);

            return new FormInfo(resourceUri, new HttpMethod(form.Method), new MediaTypeHeaderValue(form.MediaType));
        }
Esempio n. 2
0
        private static IFormDataStrategy CreateDataStrategy(Form form)
        {
            if (form == null)
            {
                return null;
            }

            var contentType = new MediaTypeHeaderValue(form.MediaType);

            if (form.Instance == null)
            {
                if (form.Schema == null)
                {
                    throw new InvalidOperationException(string.Format("Unable to create a data strategy for empty form with null schema attribute. Id: '{0}'.", form.Id));
                }
                return new ApplicationStateVariablesFormDataStrategy(new EntityBodyKey(form.Id, contentType, form.Schema), contentType);
            }

            return new PrepopulatedFormDataStrategy(form.Instance, contentType);
        }
Esempio n. 3
0
 public ShopBuilder AddForm(Form form)
 {
     forms.Add(form);
     return this;
 }