public HttpResponseMessage CreateOrUpdate(int id, Product product)
{
var existing = this.products.FirstOrDefault(x => x.Id == id);
product.Id = id;
if (product == null)
{
this.products.Add(product);
return new HttpResponseMessage(System.Net.HttpStatusCode.Created, "Created");
}
else
{
this.products.Remove(existing);
this.products.Add(product);
return new HttpResponseMessage(System.Net.HttpStatusCode.Accepted, "Updated");
}
}