Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /services/prices/ | Create a price | Create a new price on the service |
---|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using BokaMera.API.ServiceModel.Dtos;
namespace BokaMera.API.ServiceModel.Dtos
{
[ValidateRequest("IsAuthenticated")]
public partial class CreateServicePrice
: ICompany
{
public CreateServicePrice()
{
DaysOfWeek = new int[]{};
}
///<summary>
///The company id, if empty will use the company id for the user you are logged in with.
///</summary>
[ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")]
public virtual Guid? CompanyId { get; set; }
///<summary>
///The service id
///</summary>
[ApiMember(Description="The service id", IsRequired=true)]
public virtual int ServiceId { get; set; }
///<summary>
///The price
///</summary>
[ApiMember(Description="The price", IsRequired=true)]
public virtual double Price { get; set; }
///<summary>
///The price currency
///</summary>
[ApiMember(Description="The price currency", IsRequired=true)]
public virtual string CurrencyId { get; set; }
///<summary>
///The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day
///</summary>
[ApiMember(Description="The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day", IsRequired=true)]
public virtual int CalculationTypeId { get; set; }
///<summary>
///The price VAT in percent
///</summary>
[ApiMember(Description="The price VAT in percent", IsRequired=true)]
public virtual decimal VAT { get; set; }
///<summary>
///The price category if price has a category
///</summary>
[ApiMember(Description="The price category if price has a category")]
public virtual string Category { get; set; }
///<summary>
///The valid from date for the price.
///</summary>
[ApiMember(Description="The valid from date for the price.")]
public virtual DateTime From { get; set; }
///<summary>
///The valid to date for the price.
///</summary>
[ApiMember(Description="The valid to date for the price.")]
public virtual DateTime To { get; set; }
///<summary>
///If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
///</summary>
[ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")]
public virtual int[] DaysOfWeek { get; set; }
///<summary>
///If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
///</summary>
[ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")]
public virtual TimeSpan? FromTime { get; set; }
///<summary>
///If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.
///</summary>
[ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")]
public virtual TimeSpan? ToTime { get; set; }
}
public partial class DayOfWeekDto
{
public virtual int DayOfWeekId { get; set; }
public virtual int DotNetDayOfWeekId { get; set; }
public virtual string DayOfWeek { get; set; }
}
public partial class GroupBookingSettings
{
public virtual bool Active { get; set; }
public virtual int Min { get; set; }
public virtual int Max { get; set; }
}
public partial class MultipleResourceSettings
{
public virtual bool Active { get; set; }
public virtual int Min { get; set; }
public virtual int Max { get; set; }
}
public partial class ServiceInfoResponse
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; }
public virtual Uri ImageUrl { get; set; }
public virtual int? LengthInMinutes { get; set; }
public virtual int MaxNumberOfSpotsPerBooking { get; set; }
public virtual int MinNumberOfSpotsPerBooking { get; set; }
public virtual GroupBookingSettings GroupBooking { get; set; }
public virtual MultipleResourceSettings MultipleResource { get; set; }
public virtual bool IsGroupBooking { get; set; }
public virtual bool IsPaymentEnabled { get; set; }
}
public partial class ServicePriceResponse
{
public ServicePriceResponse()
{
DaysOfWeek = new List<DayOfWeekDto>{};
}
///<summary>
///The company id
///</summary>
[ApiMember(Description="The company id")]
public virtual Guid CompanyId { get; set; }
///<summary>
///The price id
///</summary>
[ApiMember(Description="The price id")]
public virtual int Id { get; set; }
///<summary>
///The service id
///</summary>
[ApiMember(Description="The service id")]
public virtual int ServiceId { get; set; }
///<summary>
///The price
///</summary>
[ApiMember(Description="The price")]
public virtual double Price { get; set; }
///<summary>
///The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day
///</summary>
[ApiMember(Description="The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day")]
public virtual int CalculationTypeId { get; set; }
///<summary>
///The price currency
///</summary>
[ApiMember(Description="The price currency")]
public virtual string CurrencyId { get; set; }
///<summary>
///The price sign
///</summary>
[ApiMember(Description="The price sign")]
public virtual string PriceSign { get; set; }
///<summary>
///The price VAT in percent
///</summary>
[ApiMember(Description="The price VAT in percent")]
public virtual decimal VAT { get; set; }
///<summary>
///The price category if price has a category
///</summary>
[ApiMember(Description="The price category if price has a category")]
public virtual string Category { get; set; }
///<summary>
///The price text to display
///</summary>
[ApiMember(Description="The price text to display")]
public virtual string PriceText { get; set; }
///<summary>
///The valid from date for the price.
///</summary>
[ApiMember(Description="The valid from date for the price.")]
public virtual DateTime From { get; set; }
///<summary>
///The valid to date for the price.
///</summary>
[ApiMember(Description="The valid to date for the price.")]
public virtual DateTime To { get; set; }
///<summary>
///If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
///</summary>
[ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")]
public virtual List<DayOfWeekDto> DaysOfWeek { get; set; }
///<summary>
///If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
///</summary>
[ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")]
public virtual TimeSpan? FromTime { get; set; }
///<summary>
///If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.
///</summary>
[ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")]
public virtual TimeSpan? ToTime { get; set; }
public virtual ServiceInfoResponse Service { get; set; }
///<summary>
///If the price is only valid for a specific time span
///</summary>
[ApiMember(Description="If the price is only valid for a specific time span")]
public virtual bool IsTimeSpecific { get; set; }
///<summary>
///If the price is only valid for specific days of week
///</summary>
[ApiMember(Description="If the price is only valid for specific days of week")]
public virtual bool IsDaysOfWeekSpecific { get; set; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /services/prices/ HTTP/1.1
Host: api.bokamera.se
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","ServiceId":0,"Price":0,"CurrencyId":"String","CalculationTypeId":0,"VAT":0,"Category":"String","DaysOfWeek":[0],"FromTime":"00:00:00","ToTime":"00:00:00"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"Id":0,"ServiceId":0,"Price":0,"CalculationTypeId":0,"CurrencyId":"String","PriceSign":"String","VAT":0,"Category":"String","PriceText":"String","DaysOfWeek":[{"DayOfWeekId":0,"DotNetDayOfWeekId":0,"DayOfWeek":"String"}],"FromTime":"00:00:00","ToTime":"00:00:00","Service":{"Id":0,"Name":"String","Description":"String","LengthInMinutes":0,"MaxNumberOfSpotsPerBooking":0,"MinNumberOfSpotsPerBooking":0,"GroupBooking":{"Active":false,"Min":0,"Max":0},"MultipleResource":{"Active":false,"Min":0,"Max":0},"IsGroupBooking":false,"IsPaymentEnabled":false},"IsTimeSpecific":false,"IsDaysOfWeekSpecific":false}