POST | /rebatecodes/fromarticle | Create RebateCode. | Create RebateCode. |
---|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using BokaMera.API.ServiceModel.Dtos;
using BokaMera.API.ServiceModel.Db;
namespace BokaMera.API.ServiceModel.Db
{
public partial class ArticleServiceRelation
: BaseModel
{
[Required]
public virtual Guid CompanyId { get; set; }
public virtual int Id { get; set; }
[Required]
public virtual int ServiceId { get; set; }
[Required]
public virtual int ArticleId { get; set; }
}
public partial class BaseModel
{
}
}
namespace BokaMera.API.ServiceModel.Dtos
{
public partial class ArticleResponse
{
public ArticleResponse()
{
Services = new List<ArticleServiceRelation>{};
ServiceIds = new List<int>{};
}
public virtual Guid CompanyId { get; set; }
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual int ArticleTypeId { get; set; }
public virtual string Description { get; set; }
public virtual string ImageUrl { get; set; }
public virtual bool Active { get; set; }
public virtual int Amount { get; set; }
public virtual double Price { get; set; }
public virtual string CurrencyId { get; set; }
public virtual DateTime UpdatedDate { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual List<ArticleServiceRelation> Services { get; set; }
public virtual List<int> ServiceIds { get; set; }
public virtual string PriceSign { get; set; }
}
[ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)]
public partial class CreateArticleRebateCode
: ICompany
{
///<summary>
///
///</summary>
[ApiMember(Description="")]
public virtual Guid? CompanyId { get; set; }
///<summary>
///Article ID for the rebate code
///</summary>
[ApiMember(Description="Article ID for the rebate code", IsRequired=true)]
public virtual int ArticleId { get; set; }
///<summary>
///Customer infomration
///</summary>
[ApiMember(Description="Customer infomration")]
public virtual CustomerToHandle Customer { get; set; }
///<summary>
///Promo code Receiver information
///</summary>
[ApiMember(Description="Promo code Receiver information")]
public virtual PromoCodeReceiver Receiver { get; set; }
}
public partial class CustomerToHandle
{
public virtual Guid? CustomerId { get; set; }
public virtual string Firstname { get; set; }
public virtual string Lastname { get; set; }
public virtual string Email { get; set; }
public virtual string Phone { get; set; }
public virtual bool SubscribedToNewsletter { get; set; }
}
public partial class DaysOfWeekResponse
{
public virtual int Id { get; set; }
public virtual string DayOfWeek { get; set; }
public virtual string DayOfWeekTranslation { get; set; }
public virtual bool? DayOfWeekActive { get; set; }
public virtual short? DayOfWeekSortOrder { get; set; }
}
public partial class PromoCodeReceiver
{
public virtual Guid? CustomerId { get; set; }
public virtual string Firstname { get; set; }
public virtual string Lastname { get; set; }
public virtual string Email { get; set; }
public virtual string ReceiverMessage { get; set; }
}
public partial class RebateCodeCustomerResponse
{
public virtual Guid Id { get; set; }
public virtual string Firstname { get; set; }
public virtual string Lastname { get; set; }
public virtual string Email { get; set; }
public virtual string Phone { get; set; }
public virtual string ImageUrl { get; set; }
}
public partial class RebateCodeResponse
{
public RebateCodeResponse()
{
DaysOfWeek = new List<DaysOfWeekResponse>{};
Services = new List<RebateCodeServiceResponse>{};
Transactions = new List<RebateCodeTransactionQueryResponse>{};
Customers = new List<RebateCodeCustomerResponse>{};
}
public virtual int Id { get; set; }
public virtual Guid? CompanyId { get; set; }
public virtual DateTime ValidFrom { get; set; }
public virtual DateTime ValidTo { 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 string CreatedBy { get; set; }
public virtual DateTime Created { get; set; }
public virtual string UpdatedBy { get; set; }
public virtual DateTime Updated { get; set; }
public virtual string PersonalNote { get; set; }
public virtual string RebateCodeSign { get; set; }
public virtual int RebateCodeValue { get; set; }
public virtual int RebateCodeTypeId { get; set; }
public virtual string Name { get; set; }
public virtual int RebateCodeStatusId { get; set; }
public virtual string StatusName { get; set; }
public virtual int MaxNumberOfUses { get; set; }
public virtual int MaxNumberOfUsesPerCustomer { get; set; }
public virtual int NumberOfUsesUsed { get; set; }
public virtual List<DaysOfWeekResponse> DaysOfWeek { get; set; }
public virtual List<RebateCodeServiceResponse> Services { get; set; }
public virtual ArticleResponse Article { get; set; }
public virtual List<RebateCodeTransactionQueryResponse> Transactions { get; set; }
public virtual double? RemainingAmount { get; set; }
public virtual int? RemainingUsage { get; set; }
public virtual List<RebateCodeCustomerResponse> Customers { get; set; }
public virtual ResponseStatus ResponseStatus { get; set; }
public virtual bool PaymentReceived { get; set; }
public virtual string RebateCodeCurrencySign { get; set; }
public virtual bool ActiveByStatus { get; set; }
public virtual string PriceSign { get; set; }
public virtual string RebateCodeTypeName { get; set; }
}
public partial class RebateCodeServiceResponse
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; }
public virtual bool Active { get; set; }
}
public partial class RebateCodeTransactionQueryResponse
{
public virtual int Id { get; set; }
public virtual Guid CompanyId { get; set; }
public virtual string Note { get; set; }
public virtual int RebateCodeId { get; set; }
public virtual string RebateCodeSign { get; set; }
public virtual int? RebateCodeTypeId { get; set; }
public virtual string RebateCodeTypeName { get; set; }
public virtual double Amount { get; set; }
public virtual int? BookingId { get; set; }
public virtual DateTime UpdatedDate { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual RebateCodeServiceResponse Service { get; set; }
public virtual RebateCodeCustomerResponse Customer { get; set; }
public virtual string PriceSign { get; set; }
}
}
C# CreateArticleRebateCode DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /rebatecodes/fromarticle HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateArticleRebateCode xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<ArticleId>0</ArticleId>
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<Customer>
<CustomerId>00000000-0000-0000-0000-000000000000</CustomerId>
<Email>String</Email>
<Firstname>String</Firstname>
<Lastname>String</Lastname>
<Phone>String</Phone>
<SubscribedToNewsletter>false</SubscribedToNewsletter>
</Customer>
<Receiver>
<CustomerId>00000000-0000-0000-0000-000000000000</CustomerId>
<Email>String</Email>
<Firstname>String</Firstname>
<Lastname>String</Lastname>
<ReceiverMessage>String</ReceiverMessage>
</Receiver>
</CreateArticleRebateCode>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <RebateCodeResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <ActiveByStatus>false</ActiveByStatus> <Article> <Active>false</Active> <Amount>0</Amount> <ArticleTypeId>0</ArticleTypeId> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <CreatedDate>0001-01-01T00:00:00</CreatedDate> <CurrencyId>String</CurrencyId> <Description>String</Description> <Id>0</Id> <ImageUrl>String</ImageUrl> <Name>String</Name> <Price>0</Price> <PriceSign>String</PriceSign> <ServiceIds xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:int>0</d3p1:int> </ServiceIds> <Services xmlns:d3p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Db"> <d3p1:ArticleServiceRelation> <d3p1:ArticleId>0</d3p1:ArticleId> <d3p1:CompanyId>00000000-0000-0000-0000-000000000000</d3p1:CompanyId> <d3p1:Id>0</d3p1:Id> <d3p1:ServiceId>0</d3p1:ServiceId> </d3p1:ArticleServiceRelation> </Services> <UpdatedDate>0001-01-01T00:00:00</UpdatedDate> </Article> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <Created>0001-01-01T00:00:00</Created> <CreatedBy>String</CreatedBy> <Customers> <RebateCodeCustomerResponse> <Email>String</Email> <Firstname>String</Firstname> <Id>00000000-0000-0000-0000-000000000000</Id> <ImageUrl>String</ImageUrl> <Lastname>String</Lastname> <Phone>String</Phone> </RebateCodeCustomerResponse> </Customers> <DaysOfWeek> <DaysOfWeekResponse> <DayOfWeek>String</DayOfWeek> <DayOfWeekActive>false</DayOfWeekActive> <DayOfWeekSortOrder>0</DayOfWeekSortOrder> <DayOfWeekTranslation>String</DayOfWeekTranslation> <Id>0</Id> </DaysOfWeekResponse> </DaysOfWeek> <FromTime>PT0S</FromTime> <Id>0</Id> <MaxNumberOfUses>0</MaxNumberOfUses> <MaxNumberOfUsesPerCustomer>0</MaxNumberOfUsesPerCustomer> <Name>String</Name> <NumberOfUsesUsed>0</NumberOfUsesUsed> <PaymentReceived>false</PaymentReceived> <PersonalNote>String</PersonalNote> <PriceSign>String</PriceSign> <RebateCodeCurrencySign>String</RebateCodeCurrencySign> <RebateCodeSign>String</RebateCodeSign> <RebateCodeStatusId>0</RebateCodeStatusId> <RebateCodeTypeId>0</RebateCodeTypeId> <RebateCodeTypeName>String</RebateCodeTypeName> <RebateCodeValue>0</RebateCodeValue> <RemainingAmount>0</RemainingAmount> <RemainingUsage>0</RemainingUsage> <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types"> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:Message>String</d2p1:Message> <d2p1:StackTrace>String</d2p1:StackTrace> <d2p1:Errors> <d2p1:ResponseError> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:FieldName>String</d2p1:FieldName> <d2p1:Message>String</d2p1:Message> <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d2p1:Meta> </d2p1:ResponseError> </d2p1:Errors> <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </d2p1:Meta> </ResponseStatus> <Services> <RebateCodeServiceResponse> <Active>false</Active> <Description>String</Description> <Id>0</Id> <Name>String</Name> </RebateCodeServiceResponse> </Services> <StatusName>String</StatusName> <ToTime>PT0S</ToTime> <Transactions> <RebateCodeTransactionQueryResponse> <Amount>0</Amount> <BookingId>0</BookingId> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <CreatedDate>0001-01-01T00:00:00</CreatedDate> <Customer> <Email>String</Email> <Firstname>String</Firstname> <Id>00000000-0000-0000-0000-000000000000</Id> <ImageUrl>String</ImageUrl> <Lastname>String</Lastname> <Phone>String</Phone> </Customer> <Id>0</Id> <Note>String</Note> <PriceSign>String</PriceSign> <RebateCodeId>0</RebateCodeId> <RebateCodeSign>String</RebateCodeSign> <RebateCodeTypeId>0</RebateCodeTypeId> <RebateCodeTypeName>String</RebateCodeTypeName> <Service> <Active>false</Active> <Description>String</Description> <Id>0</Id> <Name>String</Name> </Service> <UpdatedDate>0001-01-01T00:00:00</UpdatedDate> </RebateCodeTransactionQueryResponse> </Transactions> <Updated>0001-01-01T00:00:00</Updated> <UpdatedBy>String</UpdatedBy> <ValidFrom>0001-01-01T00:00:00</ValidFrom> <ValidTo>0001-01-01T00:00:00</ValidTo> </RebateCodeResponse>