public IHttpActionResult Post(FeaturedBook fb) { if (fb == null) { return(StatusCode(HttpStatusCode.NoContent)); } else { context.FeaturedBooks.Add(fb); context.SaveChanges(); return(Ok(fb)); } }
public IHttpActionResult PUT([FromUri] int id, [FromBody] FeaturedBook fb) { var item = context.FeaturedBooks.Where(c => c.Id == id).FirstOrDefault(); if (item == null) { return(StatusCode(HttpStatusCode.NoContent)); } else { item.Book_Id = fb.Book_Id; context.SaveChanges(); return(Ok(item)); } }