public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] PropertyMode propertyMode) { ViewBag.NavigatedTO = "Rent"; if (id != propertyMode.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(propertyMode); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PropertyModeExists(propertyMode.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(propertyMode)); }
/// <summary> /// Initializes a new instance of the <see cref="GetContactsByEmailBatchQuery"/> class. /// </summary> /// <param name="props"> /// By default, all valued properties will be included. If you include the "property" parameter, /// then the returned data will only include the property or properties that you request. You can /// include this parameter multiple times to specify multiple properties. The lastmodifieddate and /// associatedcompanyid will always be included, even if not specified. Keep in mind that only /// properties that have a value will be included in the response, even if specified in the URL.</param> /// <param name="propertyMode"> /// One of “value_only” or “value_and_history” to specify if the current value for a property /// should be fetched, or the value and all the historical values for that property. Default /// is “value_and_history”. /// </param> /// <param name="formSubmissionMode"> /// One of “all,” “none,” “newest,” “oldest” to specify which form submissions should be fetched. /// Default is “all.” /// </param> /// <param name="showListMemberships"> /// Boolean "true" or "false" to indicate whether current list memberships should be fetched for the contact. /// Default is true. /// </param> public GetContactsByEmailBatchQuery(string[] props, PropertyMode propertyMode = PropertyMode.value_and_history, FormSubmissionMode formSubmissionMode = ModelEnums.FormSubmissionMode.all, bool showListMemberships = true) { this.Properties = props; this.PropertyMode = propertyMode; this.FormSubmissionMode = formSubmissionMode.ToString(); this.ShowListMemberships = showListMemberships; }
/// <summary> /// Initializes a new instance of the <see cref="GetContactQuery"/> class. /// </summary> /// <param name="props"> /// By default, all valued properties will be included. If you include the "property" parameter, /// then the returned data will only include the property or properties that you request. You can /// include this parameter multiple times to specify multiple properties. The lastmodifieddate and /// associatedcompanyid will always be included, even if not specified. Keep in mind that only /// properties that have a value will be included in the response, even if specified in the URL.</param> /// <param name="propertyMode"> /// One of “value_only” or “value_and_history” to specify if the current value for a property /// should be fetched, or the value and all the historical values for that property. Default /// is “value_and_history”. /// </param> /// <param name="formSubmissionMode"> /// One of “all,” “none,” “newest,” “oldest” to specify which form submissions should be fetched. /// Default is “all.” /// </param> /// <param name="showListMemberships"> /// Boolean "true" or "false" to indicate whether current list memberships should be fetched for the contact. /// Default is true. /// </param> public GetContactQuery(string[] props, PropertyMode propertyMode = PropertyMode.value_and_history, FormSubmissionMode formSubmissionMode = FormSubmissionMode.all, bool showListMemberships = true) { this.properties = props; this.propertyMode = propertyMode.ToString(); this.formSubmissionMode = formSubmissionMode.ToString(); this.showListMemberships = showListMemberships; }
public PropertyBuilder(AssemblyBuilder assembly, string name, PropertyMode mode, string propertyType, int field, bool isArray) : base(assembly, name) { Mode = mode; PropertyType = propertyType; Field = field; IsArray = isArray; }
public async Task PropertyMode_is_added_to_queryString(PropertyMode propertyMode, string queryStringValue, [Frozen] IHttpRestClient client, IHubSpotContactClient sut, long contactId, Contact contact) { Mock.Get(client) .Setup(p => p.SendAsync <Contact>(HttpMethod.Get, $"/contacts/v1/contact/vid/{contactId}/profile", It.IsAny <IQueryString>())) .ReturnsAsync(contact) .Verifiable(); var response = await sut.GetByIdAsync(contactId, propertyMode : propertyMode); Mock.Get(client) .Verify(p => p.SendAsync <Contact>(HttpMethod.Get, $"/contacts/v1/contact/vid/{contactId}/profile", QueryStringMatcher.That(Does.Contain($"propertyMode={queryStringValue}")))); }
public void AddPropertyMode_adds_value(PropertyMode mode, string value) { var builder = new HttpQueryStringBuilder(); HttpQueryStringBuilderExtensions.AddPropertyMode(builder, mode); Assume.That(builder.HasKey("propertyMode")); var query = builder.BuildQuery(); Assert.That(query.Query, Contains.Substring($"propertyMode={value}")); }
public async Task <IActionResult> Create([Bind("Id,Name")] PropertyMode propertyMode) { ViewBag.NavigatedTO = "Rent"; if (ModelState.IsValid) { _context.Add(propertyMode); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(propertyMode)); }
/// <summary> /// Initializes a new instance of the <see cref="GetAllContactsQuery"/> class. /// </summary> /// <param name="count">The number of records to receive default is 20, max is 100.</param> /// <param name="vidOffset">The vid offset of the previous call if any. This will return a new "page" of contacts.</param> /// <param name="property">The names of the properties to return in the response.</param> /// <param name="propertyMode">Determines whether the history of the properties are returned along with the values or just the values.</param> /// <param name="formSubmissionMode">Designates which form submission should be fetched. The default is "newest".</param> /// <param name="showListMemberships">Indicates whether or not the response will contain all list memberships for each contact.</param> public GetAllContactsQuery( int count = 20, int vidOffset = 0, string[] property = null, PropertyMode propertyMode = PropertyMode.value_and_history, FormSubmissionMode formSubmissionMode = ContactsApi.ModelEnums.FormSubmissionMode.all, bool showListMemberships = true) { this.Count = count.ToString(); this.VidOffset = vidOffset; this.Property = property; this.PropertyMode = propertyMode; this.FormSubmissionMode = formSubmissionMode.ToString(); this.ShowListMemberships = showListMemberships; }
/// <summary> /// Initializes a new instance of the <see cref="GetHubSpotContactOp"/> class. /// </summary> /// <param name="email"> /// The email address for the contact you're searching for. /// </param> /// <param name="vid"> /// Unique identifier for a particular contact. In HubSpot's contact system, contact ID's are called "vid", as you can see in the API output below. /// </param> /// <param name="properties"> /// By default, all valued properties will be included. If you include the "property" parameter, then the returned data will only include the property /// or properties that you request. You can include this parameter multiple times to specify multiple properties. The lastmodifieddate and associatedcompanyid will always be /// included, even if not specified. Keep in mind that only properties that have a value will be included in the response, even if specified in the URL. /// </param> /// <param name="propertyMode"> /// One of “value_only” or “value_and_history” to specify if the current value for a property should be fetched, /// or the value and all the historical values for that property. Default is “value_and_history”. /// </param> /// <param name="formSubmissionMode"> /// One of “all”, “none”, “newest”, “oldest” to specify which form submissions should be fetched. Default is “all”. /// </param> /// <param name="showListMembership"> /// Boolean "true" or "false" to indicate whether current list memberships should be fetched for the contact. Default is true. /// </param> public GetHubSpotContactOp( string email, int vid, string[] properties, PropertyMode propertyMode = PropertyMode.value_and_history, FormSubmissionMode formSubmissionMode = FormSubmissionMode.all, bool showListMembership = true) { (string.IsNullOrWhiteSpace(email)).MustForArg( FormattableString.Invariant($"Both {nameof(email)} and {nameof(vid)} cannot be null")); this.Email = email; this.Vid = vid; this.FormSubmissionMode = formSubmissionMode; this.ShowListMembership = showListMembership; this.Properties = properties; this.PropertyMode = propertyMode; //this.Query = new GetContactQuery(new string[]{this.Vid}); }
internal extern static int _XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, uint[] data, int nelements);
internal static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr atoms, int nelements) { DebugHelper.TraceWriteLine ("XChangeProperty"); return _XChangeProperty(display, window, property, type, format, mode, atoms, nelements); }
internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr[] data, int nelements);
async Task <ContactList> IHubSpotListClient.GetContactsInListAsync(long listId, IReadOnlyList <IProperty> properties, PropertyMode propertyMode, FormSubmissionMode formSubmissionMode, bool showListMemberships, int count, long?contactOffset) { if (count > 100) { throw new ArgumentOutOfRangeException(nameof(count), "Up to 100 contacts can be requested at the same time"); } var builder = new HttpQueryStringBuilder(); builder.AddProperties(properties); builder.AddPropertyMode(propertyMode); builder.AddFormSubmissionMode(formSubmissionMode); builder.AddShowListMemberships(showListMemberships); builder.Add("count", count.ToString()); builder.Add("vidOffset", contactOffset); var list = await _client.GetAsync <ContactList>($"/contacts/v1/lists/{listId}/contacts/all", builder.BuildQuery()); return(list); }
public static extern int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, void *data, int nelements);
internal extern static int XChangeProperty (IntPtr display, IntPtr window, int property, int format, int type, PropertyMode mode, uint[] atoms, int nelements);
public static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref int value, int nelements);
internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr atoms, int nelements);
public void AddPropertyMode_builder_is_required(PropertyMode testValue) { Assert.Throws <ArgumentNullException>(() => HttpQueryStringBuilderExtensions.AddPropertyMode(null, testValue)); }
internal static extern int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref IntPtr value, int nelements);
public void PushPropertyMode(PropertyMode mode) { this.propertyModes.Push(mode); }
private async Task <bool> AddressbookMultigetAsync(IStore store, IHttpContext httpContext, XElement report, CancellationToken cancellationToken) { // Obtain entry var request = httpContext.Request; var response = httpContext.Response; var topEntry = await store.GetItemAsync(request.Url, httpContext, cancellationToken).ConfigureAwait(false); if (topEntry == null) { response.SetStatus(DavStatusCode.NotFound); return(true); } PropertyMode propertyMode = PropertyMode.AllProperties; var propertyList = new List <XName>(); foreach (var xProp in report.Elements()) { // Check if we should fetch all property names if (xProp.Name == WebDavNamespaces.DavNs + "propname") { propertyMode = PropertyMode.PropertyNames; } else if (xProp.Name == WebDavNamespaces.DavNs + "allprop") { propertyMode = PropertyMode.AllProperties; } else if (xProp.Name == WebDavNamespaces.DavNs + "prop") { propertyMode = PropertyMode.SelectedProperties; // Include all specified properties foreach (var xSubProp in xProp.Elements()) { propertyList.Add(xSubProp.Name); } } } // Generate the list of items from which we need to obtain the properties var entries = new List <PropertyEntry>(); if (topEntry is IStoreCollection topCollection) { foreach (var href in report.Elements(WebDavNamespaces.DavNs + "href")) { var uri = new Uri(request.Url, href.Value); if (!request.Url.IsBaseOf(uri)) { //need to be members (not necessarily internal members) of the resource identified by the Request-URI continue; } var item = await store.GetItemAsync(uri, httpContext, cancellationToken).ConfigureAwait(false); entries.Add(new PropertyEntry(uri, item)); } } else { entries.Add(new PropertyEntry(request.Url, topEntry)); } // Obtain the status document var xMultiStatus = new XElement(WebDavNamespaces.DavNs + "multistatus"); var xDocument = new XDocument(xMultiStatus); // Add all the properties foreach (var entry in entries) { // Create the property var xResponse = new XElement(WebDavNamespaces.DavNs + "response", new XElement(WebDavNamespaces.DavNs + "href", UriHelper.ToEncodedString(entry.Uri))); // Create tags for property values var xPropStatValues = new XElement(WebDavNamespaces.DavNs + "propstat"); if (entry.Entry == null) { xPropStatValues.Add(new XElement(WebDavNamespaces.DavNs + "status", "HTTP/1.1 404 Not Found")); xResponse.Add(xPropStatValues); } else { // Check if the entry supports properties var propertyManager = entry.Entry.PropertyManager; if (propertyManager != null) { // Handle based on the property mode if (propertyMode == PropertyMode.PropertyNames) { // Add all properties foreach (var property in propertyManager.Properties) { xPropStatValues.Add(new XElement(property.Name)); } // Add the values xResponse.Add(xPropStatValues); } else { var addedProperties = new List <XName>(); if ((propertyMode & PropertyMode.AllProperties) != 0) { foreach (var propertyName in propertyManager.Properties.Where(p => !p.IsExpensive) .Select(p => p.Name)) { await AddPropertyAsync(httpContext, xResponse, xPropStatValues, propertyManager, entry.Entry, propertyName, addedProperties, cancellationToken) .ConfigureAwait(false); } } if ((propertyMode & PropertyMode.SelectedProperties) != 0) { foreach (var propertyName in propertyList) { await AddPropertyAsync(httpContext, xResponse, xPropStatValues, propertyManager, entry.Entry, propertyName, addedProperties, cancellationToken) .ConfigureAwait(false); } } // Add the values (if any) if (xPropStatValues.HasElements) { xResponse.Add(xPropStatValues); } } } // Add the status xPropStatValues.Add(new XElement(WebDavNamespaces.DavNs + "status", "HTTP/1.1 200 OK")); } // Add the property xMultiStatus.Add(xResponse); } // Stream the document await response.SendResponseAsync(DavStatusCode.MultiStatus, xDocument, cancellationToken).ConfigureAwait(false); // Finished writing return(true); }
internal static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, string text, int text_length) { DebugHelper.TraceWriteLine ("XChangeProperty"); return _XChangeProperty(display, window, property, type, format, mode, text, text_length); }
public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr atoms, int nelements);
internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref MotifWmHints data, int nelements);
async Task <Contact> IHubSpotContactClient.GetByIdAsync(long contactId, IReadOnlyList <IProperty> properties, PropertyMode propertyMode, FormSubmissionMode formSubmissionMode, bool showListMemberships) { var builder = new HttpQueryStringBuilder(); builder.AddProperties(properties); builder.AddPropertyMode(propertyMode); builder.AddFormSubmissionMode(formSubmissionMode); builder.AddShowListMemberships(showListMemberships); try { var contact = await _client.GetAsync <Contact>($"/contacts/v1/contact/vid/{contactId}/profile", builder.BuildQuery()); return(contact); } catch (HttpException ex) when(ex.StatusCode == HttpStatusCode.NotFound) { throw new NotFoundException("Contact not found", ex); } }
internal extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, string text, int text_length);
async Task <Contact> IHubSpotContactClient.GetByUserTokenAsync(string userToken, IReadOnlyList <IProperty> properties, PropertyMode propertyMode, FormSubmissionMode formSubmissionMode, bool showListMemberships) { if (string.IsNullOrEmpty(userToken)) { throw new ArgumentNullException(nameof(userToken)); } var builder = new HttpQueryStringBuilder(); builder.AddProperties(properties); builder.AddPropertyMode(propertyMode); builder.AddFormSubmissionMode(formSubmissionMode); builder.AddShowListMemberships(showListMemberships); try { var contact = await _client.GetAsync <Contact>($"/contacts/v1/contact/utk/{userToken}/profile", builder.BuildQuery()); return(contact); } catch (HttpException ex) when(ex.StatusCode == HttpStatusCode.NotFound) { throw new NotFoundException("Contact not found", ex); } }
public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, ref MotifWmHints data, int nelements);
internal extern static int XChangeProperty (IntPtr display, IntPtr window, int property, Atom format, int type, PropertyMode mode, ref uint value, int nelements);
public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, string text, int text_length);
public void SetProperty(CameraProperty prop, int val, PropertyMode flags) { addLog("SetProperty..."); if (cam == null) { addLog("SetProperty no cam!"); return; } switch (prop) { case CameraProperty.Illumination: if (cam.Features.Torch.Available) cam.Features.Torch.CurrentValue = cam.Features.Torch.MaxValue; break; case CameraProperty.ColorEnable: break; } addLog("SetProperty done"); }
async Task <ContactList> IHubSpotContactClient.GetRecentlyCreatedAsync(IReadOnlyList <IProperty> properties, PropertyMode propertyMode, FormSubmissionMode formSubmissionMode, bool showListMemberships, int count, long?contactOffset, DateTimeOffset?timeOffset) { if (count > 100) { throw new ArgumentOutOfRangeException(nameof(count), "Up to 100 contacts can be requested at the same time"); } var builder = new HttpQueryStringBuilder(); builder.AddProperties(properties); builder.AddPropertyMode(propertyMode); builder.AddFormSubmissionMode(formSubmissionMode); builder.AddShowListMemberships(showListMemberships); builder.Add("count", count.ToString()); if (contactOffset.HasValue) { builder.Add("vidOffset", contactOffset.Value.ToString()); } if (timeOffset.HasValue) { builder.Add("timeOffset", timeOffset.Value.ToUnixTimeMilliseconds().ToString()); } var list = await _client.GetAsync <ContactList>("/contacts/v1/lists/all/contacts/recent", builder.BuildQuery()); return(list); }
public extern static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, IntPtr[] data, int nelements);
async Task <IReadOnlyDictionary <long, Contact> > IHubSpotContactClient.GetManyByIdAsync(IReadOnlyList <long> contactIds, IReadOnlyList <IProperty> properties, PropertyMode propertyMode, FormSubmissionMode formSubmissionMode, bool showListMemberships, bool includeDeletes) { if (contactIds == null || contactIds.Count == 0) { return(new Dictionary <long, Contact>()); } if (contactIds.Count >= 100) { throw new ArgumentOutOfRangeException(nameof(contactIds), "Up to 100 contacts can be requested at the same time"); } var builder = new HttpQueryStringBuilder(); foreach (var id in contactIds) { builder.Add("vid", id.ToString()); } builder.AddProperties(properties); builder.AddPropertyMode(propertyMode); builder.AddFormSubmissionMode(formSubmissionMode); builder.AddShowListMemberships(showListMemberships); var contacts = await _client.GetAsync <Dictionary <long, Contact> >("/contacts/v1/contact/vids/batch/", builder.BuildQuery()); return(contacts); }
public static int XChangeProperty(IntPtr display, IntPtr window, IntPtr property, IntPtr type, int format, PropertyMode mode, uint[] data, int nelements);