public IHttpActionResult PutService(int id, Service service) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != service.ServiceID) { return(BadRequest()); } db.Entry(service).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ServiceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutCommentSkillTalent(int id, CommentSkillTalent commentSkillTalent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != commentSkillTalent.CommentID) { return(BadRequest()); } db.Entry(commentSkillTalent).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CommentSkillTalentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutBook(int id, Book book) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != book.BookID) { return(BadRequest()); } db.Entry(book).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BookExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutTransport(int id, Transport transport) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != transport.TransportationID) { return(BadRequest()); } db.Entry(transport).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TransportExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutLikeProduct(int id, LikeProduct likeProduct) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != likeProduct.likeId) { return(BadRequest()); } db.Entry(likeProduct).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LikeProductExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutAccommodation(int id, Accommodation accommodation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != accommodation.AccommodationID) { return(BadRequest()); } db.Entry(accommodation).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AccommodationExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }