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)); }
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); }
public ShopBuilder AddForm(Form form) { forms.Add(form); return this; }