public IHttpActionResult Putcollections_detail(int id, collections_detail collections_detail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != collections_detail.collection_id) { return(BadRequest()); } db.Entry(collections_detail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!collections_detailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getcollections_detail(int id) { collections_detail collections_detail = db.collections_detail.Find(id); if (collections_detail == null) { return(NotFound()); } return(Ok(collections_detail)); }
public IHttpActionResult Deletecollections_detail(int id) { collections_detail collections_detail = db.collections_detail.Find(id); if (collections_detail == null) { return(NotFound()); } db.collections_detail.Remove(collections_detail); db.SaveChanges(); return(Ok(collections_detail)); }
public IHttpActionResult Postcollections_detail(string member_id, string tourism_id, int collection_type_id) { collections_detail collect = new collections_detail(); collect.member_id = member_id; collect.tourism_id = tourism_id; collect.privacy = true; collect.collection_type_id = collection_type_id; db.collections_detail.Add(collect); db.SaveChanges(); return(Ok(collect)); }
public ActionResult Postcollections_detail(string member_id, string tourism_id, int collection_type_id = 1) { string id = tourism_id.Substring(0, 1); string controller; switch (id) { case "A": controller = "web_activities"; break; case "H": controller = "WebHotels"; break; case "R": controller = "WebRestaurants"; break; case "S": controller = "WebSpots"; break; default: controller = "web_activities"; break; } collections_detail collect = new collections_detail() { member_id = member_id, tourism_id = tourism_id, privacy = true, collection_type_id = collection_type_id }; if (ModelState.IsValid) { db.collections_detail.Add(collect); db.SaveChanges(); return(RedirectToRoute(new { controller = controller, action = "Details", id = tourism_id })); } return(RedirectToRoute(new { controller = controller, action = "Details", id = tourism_id })); }
public ActionResult Deletecollections_detail(string member_id, string tourism_id, int collection_type_id = 1) { collections_detail collections_detail = db.collections_detail.Where(m => m.collection_type_id == collection_type_id && m.member_id == member_id && m.tourism_id == tourism_id).FirstOrDefault(); db.collections_detail.Remove(collections_detail); db.SaveChanges(); string id = tourism_id.Substring(0, 1); string controller; switch (id) { case "A": controller = "web_activities"; break; case "H": controller = "WebHotels"; break; case "R": controller = "WebRestaurants"; break; case "S": controller = "WebSpots"; break; default: controller = "web_activities"; break; } return(RedirectToRoute(new { controller = controller, action = "Details", id = tourism_id })); }