1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
   | /// <summary>
///     Define your ServiceStack web service request (i.e. Request DTO).
/// </summary>
/// <remarks>The route is defined here rather than in the AppHost.</remarks>
[Api("GET or DELETE a single movie by Id. Use POST to create a new Gateway_Registration_Payload and PUT to update it")]
[Route("/Gateway_Registration_Payload", "POST,PUT,PATCH,DELETE")]
[Route("/Gateway_Registration_Payload/{Id}")]
public class Gateway_Registration_Payload : IReturn<Gateway_Registration_Payload_Response>
{
    /// <summary>
    ///     Initializes a new instance of the movie.
    /// </summary>
    public Gateway_Registration_Payload()
    {
        this.Genres = new List<string>();
    }
    /// <summary>
    ///     Gets or sets the id of the movie. The id will be automatically incremented when added.
    /// </summary>
    [AutoIncrement]
    public int Id { get; set; }
 
    public int SessionID { get; set; }
    public List<string> Genres { get; set; }
}
 
/// <summary>
///     Define your ServiceStack web service response (i.e. Response DTO).
/// </summary>
public class Gateway_Registration_Payload_Response
{
    /// <summary>
    ///     Gets or sets the movie.
    /// </summary>
    public Gateway_Registration_Payload Gateway_Registration_Payload { get; set; }
}
 
/// <summary>
///     Create your ServiceStack restful web service implementation.
/// </summary>
public class Gateway_Registration_Payload_Service : Service
{
    /// <summary>
    ///     GET /Gateway_Registration_Payload/{Id}
    /// </summary>
    public Gateway_Registration_Payload_Response Get(Gateway_Registration_Payload Gateway_Registration_Payload)
    {
        return new Gateway_Registration_Payload_Response
                   {
                       Gateway_Registration_Payload = Db.Id<Gateway_Registration_Payload>(Gateway_Registration_Payload.Id),
                   };
    }
 
    /// <summary>
    ///     POST /Gateway_Registration_Payload
    ///     returns HTTP Response =>
    ///     201 Created
    ///     Location: http://localhost/ServiceStack.MovieRest/Gateway_Registration_Payload/{newGateway_Registration_PayloadId}
    ///     {newMovie DTO in [xml|json|jsv|etc]}
    /// </summary>
    public object Post(Gateway_Registration_Payload Gateway_Registration_Payload)
    {
        Db.Insert(Gateway_Registration_Payload);
        var newGateway_Registration_PayloadId = Db.GetLastInsertId();
 
        var newGateway_Registration_Payload = new Gateway_Registration_Payload_Response
                           {
                               Gateway_Registration_Payload = Db.Id<Gateway_Registration_Payload>(newGateway_Registration_PayloadId),
                           };
 
        return new HttpResult(newGateway_Registration_Payload)
                   {
                       StatusCode = HttpStatusCode.Created,
                       Headers =
                           {
                               {HttpHeaders.Location, base.Request.AbsoluteUri.CombineWith(newGateway_Registration_PayloadId.ToString())}
                           }
                   };          
    }
 
    /// <summary>
    ///     PUT /Gateway_Registration_Payload/{id}
    /// </summary>
    public object Put(Gateway_Registration_Payload Gateway_Registration_Payload)
    {
        Db.Update(Gateway_Registration_Payload);
 
        return new HttpResult
                   {
                       StatusCode = HttpStatusCode.NoContent,
                       Headers =
                           {
                               {HttpHeaders.Location, this.RequestContext.AbsoluteUri.CombineWith(Gateway_Registration_Payload.Id.ToString())}
                           }
                   };
    }
 
    /// <summary>
    ///     DELETE /Gateway_Registration_Payload/{Id}
    /// </summary>
    public object Delete(Gateway_Registration_Payload request)
    {
        Db.DeleteById<Gateway_Registration_Payload>(request.Id);
 
        return new HttpResult
                   {
                       StatusCode = HttpStatusCode.NoContent,
                       Headers =
                           {
                               {HttpHeaders.Location, this.RequestContext.AbsoluteUri.CombineWith(request.Id.ToString())}
                           }
                   };
    }
} | 
Partager