public async Task<IHttpActionResult> UpdateProduct(int id, Product product)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != product.Id)
            {
                return BadRequest();
            }

            db.Entry(product).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public async Task<IHttpActionResult> PostProduct(Product product)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.Products.Add(product);
            await db.SaveChangesAsync();

            return CreatedAtRoute("GetProductById", new { id = product.Id }, product);
        }
        public void CreateNewProduct_UriLinkGeneration_BasedOnAttributeRouteName()
        {
            Product prd = new Product();
            prd.Name = "Lync";

            HttpResponseMessage response = client.PostAsJsonAsync<Product>("api/products", prd).Result;

            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);

            Product createdProduct = response.Content.ReadAsAsync<Product>().Result;

            Assert.AreEqual(
                expected: string.Format("{0}api/products/{1}", baseAddress, createdProduct.Id),
                actual: response.Headers.Location.ToString(),
                ignoreCase: true);
        }