Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
30 lines (25 sloc) 0.993 kb
using System;
using System.Net;
using ServiceStack.Northwind.ServiceModel.Operations;
using ServiceStack.Northwind.ServiceModel.Types;
using ServiceStack.OrmLite;
namespace ServiceStack.Northwind.ServiceInterface
{
public class CustomerDetailsService : Service
{
public CustomerDetailsResponse Get(CustomerDetails request)
{
var customer = Db.SingleById<Customer>(request.Id);
if (customer == null)
throw new HttpError(HttpStatusCode.NotFound,
new ArgumentException("Customer does not exist: " + request.Id));
var ordersService = base.ResolveService<OrdersService>();
var ordersResponse = (OrdersResponse) ordersService.Get(new Orders {CustomerId = customer.Id});
return new CustomerDetailsResponse
{
Customer = customer,
CustomerOrders = ordersResponse.Results,
};
}
}
}
Jump to Line
Something went wrong with that request. Please try again.