| POST | /customerarticle/fromarticle | Create CustomerArticle. | Create CustomerArticle. |
|---|
using System;
using System.IO;
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.Dtos.Commons;
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 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 int SortOrder { 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; }
public virtual decimal? VAT { get; set; }
}
[ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)]
public partial class CreateCustomerArticleFromArticle
: FromArticleBase, ICompany
{
}
public partial class CustomerArticleCompanyResponse
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual string LogoType { get; set; }
public virtual string Email { get; set; }
public virtual string Phone { get; set; }
public virtual string City { get; set; }
public virtual string Street1 { get; set; }
public virtual string ZipCode { get; set; }
public virtual string CountryId { get; set; }
}
public partial class CustomerArticleCustomerResponse
{
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 partial class CustomerArticleResponse
{
public virtual int Id { get; set; }
public virtual Guid CompanyId { get; set; }
public virtual int? ArticleId { get; set; }
public virtual decimal? Price { get; set; }
public virtual decimal? VAT { get; set; }
public virtual string CurrencyId { get; set; }
public virtual int StatusId { get; set; }
public virtual string StatusName { get; set; }
public virtual Guid? CustomerId { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual DateTime UpdatedDate { get; set; }
public virtual ArticleResponse Article { get; set; }
public virtual CustomerArticleCustomerResponse Customer { get; set; }
public virtual CustomerArticleCompanyResponse Company { get; set; }
public virtual List<PaymentLogResponse> PaymentLog { get; set; } = [];
public virtual ResponseStatus ResponseStatus { get; set; }
}
public partial class CustomerToHandle
: CustomerBase
{
}
public partial class FromArticleBase
{
///<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 information
///</summary>
[ApiMember(Description="Customer information")]
public virtual CustomerToHandle Customer { get; set; }
///<summary>
///If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinairy profile.
///</summary>
[ApiMember(Description="If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinairy profile. ")]
public virtual InvoiceAddressToHandle InvoiceAddress { get; set; }
}
public partial class InvoiceAddressToHandle
: IInvoiceAddress
{
public virtual string CorporateIdentityNumber { get; set; }
public virtual string InvoiceAddress1 { get; set; }
public virtual string InvoiceAddress2 { get; set; }
public virtual string InvoiceCity { get; set; }
public virtual string InvoicePostalCode { get; set; }
public virtual string InvoiceCountryCode { get; set; }
}
public partial class PaymentLogResponse
{
public virtual int Id { get; set; }
public virtual double? Amount { get; set; }
public virtual double? AmountCredited { get; set; }
public virtual string CurrencyId { get; set; }
public virtual string Comments { get; set; }
public virtual DateTime Created { get; set; }
public virtual DateTime Updated { get; set; }
}
}
namespace BokaMera.API.ServiceModel.Dtos.Commons
{
public partial class CustomerBase
: ICustomerBase
{
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 virtual string PersonalIdentityNumber { get; set; }
}
}
C# CreateCustomerArticleFromArticle DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /customerarticle/fromarticle HTTP/1.1
Host: testapi.bokamera.se
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","ArticleId":0,"Customer":{"CustomerId":"00000000-0000-0000-0000-000000000000","Firstname":"String","Lastname":"String","Email":"String","Phone":"String","SubscribedToNewsletter":false,"PersonalIdentityNumber":"String"},"InvoiceAddress":{"CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"Id":0,"ArticleId":0,"Price":0,"VAT":0,"CurrencyId":"String","StatusId":0,"StatusName":"String","CustomerId":"00000000-0000-0000-0000-000000000000","Article":{"Id":0,"Name":"String","ArticleTypeId":0,"Description":"String","ImageUrl":"String","Active":false,"Amount":0,"Price":0,"CurrencyId":"String","SortOrder":0,"Services":[{"Id":0,"ServiceId":0,"ArticleId":0}],"ServiceIds":[0],"PriceSign":"String","VAT":0},"Customer":{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String"},"Company":{"Name":"String","LogoType":"String","Email":"String","Phone":"String","City":"String","Street1":"String","ZipCode":"String","CountryId":"String"},"PaymentLog":[{"Id":0,"Amount":0,"AmountCredited":0,"CurrencyId":"String","Comments":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}