public IHttpActionResult PostClothingShops(ClothingShops clothingShops) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ClothingShops.Add(clothingShops); try { db.SaveChanges(); } catch (DbUpdateException) { if (ClothingShopsExists(clothingShops.id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = clothingShops.id }, clothingShops)); }
public IHttpActionResult PutClothingShops(long id, ClothingShops clothingShops) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != clothingShops.id) { return(BadRequest()); } db.Entry(clothingShops).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ClothingShopsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { ClothingShops clothingShop = db.ClothingShops.Find(id); db.ClothingShops.Remove(clothingShop); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,lon,lat,Name,ReviewGrade,NumberGrades")] ClothingShops clothingShop) { if (ModelState.IsValid) { db.Entry(clothingShop).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(clothingShop)); }
public IHttpActionResult GetClothingShops(long id) { ClothingShops clothingShops = db.ClothingShops.Find(id); if (clothingShops == null) { return(NotFound()); } return(Ok(clothingShops)); }
public ActionResult Create([Bind(Include = "Id,lon,lat,Name,ReviewGrade,NumberGrades")] ClothingShops clothingShop) { if (ModelState.IsValid) { db.ClothingShops.Add(clothingShop); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(clothingShop)); }
public IHttpActionResult DeleteClothingShops(long id) { ClothingShops clothingShops = db.ClothingShops.Find(id); if (clothingShops == null) { return(NotFound()); } db.ClothingShops.Remove(clothingShops); db.SaveChanges(); return(Ok(clothingShops)); }
// GET: ClothingShops/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ClothingShops clothingShop = db.ClothingShops.Find(id); if (clothingShop == null) { return(HttpNotFound()); } return(View(clothingShop)); }