Ejemplo n.º 1
0
        public object Post(CreateLicense request)
        {
            var license = new Model.License().PopulateWith(request);

            documentSession.Store(license);
            documentSession.SaveChanges();

            return
                (new HttpResult(new LicenseDto
            {
                Customer = documentSession.Load <Customer>(license.CustomerId),
                Product =
                    new ProductDto().PopulateWith(documentSession.Load <Product>(license.ProductId))
            }.PopulateWith(license))
            {
                StatusCode = HttpStatusCode.Created,
                Headers =
                {
                    { HttpHeaders.Location, Request.AbsoluteUri.CombineWith(license.Id) }
                }
            });
        }
Ejemplo n.º 2
0
        public object Post(CreateLicense request)
        {
            var license = new Model.License().PopulateWith(request);

            documentSession.Store(license);
            documentSession.SaveChanges();

            return
                new HttpResult(new LicenseDto
                                   {
                                       Customer = documentSession.Load<Customer>(license.CustomerId),
                                       Product =
                                           new ProductDto().PopulateWith(documentSession.Load<Product>(license.ProductId))
                                   }.PopulateWith(license))
                    {
                        StatusCode = HttpStatusCode.Created,
                        Headers =
                            {
                                {HttpHeaders.Location, Request.AbsoluteUri.CombineWith(license.Id)}
                            }
                    };
        }
Ejemplo n.º 3
0
 public async Task <IActionResult> Post([FromBody] CreateLicense command)
 => await DispatchAsync(command.BindId(c => c.Id).Bind(c => c.CustomerId, UserId));