TestService.Create C# (CSharp) Метод

Create() приватный Метод

private Create ( Product, product ) : HttpResponseMessage,
product Product,
Результат HttpResponseMessage,
	public HttpResponseMessage Create(Product product)
	{
		var id = this.products.Select(x => x.Id).OrderBy(x => x).Last() + 1;
		product.Id = id;

		this.products.Add(product);

		var response = new HttpResponseMessage<Product>(product, System.Net.HttpStatusCode.Created);
		response.Headers.Location = new Uri(resourceName + "/" + id.ToString(), UriKind.Relative);

		return response;
	}

Usage Example

Пример #1
0
        public async Task Basic()
        {
            var service = TestService.Create(TestService.UnrestrictedOptions, new[] { typeof(Qbservable2) }, Observable.Range(0, 5));
            var results = await service.QueryAsync(xs => xs.WhereEven(x => x));

            QactiveAssert.AreEqual(results, OnNext(0), OnNext(2), OnNext(4), OnCompleted <int>());
        }
All Usage Examples Of TestService::Create