public ActionResult Delete(int id)
        {
            FurnitureShop furnitureShop = db.FurnitureShops.Find(id);

            db.FurnitureShops.Remove(furnitureShop);
            db.SaveChanges();
            return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
 public IActionResult Create([Bind("ShopId,ShopAddress,ShopEmail,ShopPhoneNum")] FurnitureShop furnitureShop)
 {
     if (ModelState.IsValid)
     {
         _furnitureShopRepository.Create(furnitureShop);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(furnitureShop));
 }
 public ActionResult Edit([Bind(Include = "FurnitureShopId,Name,Owner,Address,Phone,Email,Website,Pib,AccountNo")] FurnitureShop furnitureShop)
 {
     if (ModelState.IsValid)
     {
         db.Entry(furnitureShop).State = EntityState.Modified;
         db.SaveChanges();
         return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
     }
     return(View(furnitureShop));
 }
예제 #4
0
        public IActionResult Edit(int id, [Bind("ShopId,ShopAddress,ShopEmail,ShopPhoneNum")] FurnitureShop furnitureShop)
        {
            if (id != furnitureShop.ShopId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                _furnitureShopRepository.Update(furnitureShop);
                return(RedirectToAction(nameof(Index)));
            }
            return(View(furnitureShop));
        }
        // GET: FurnitureShops/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FurnitureShop furnitureShop = db.FurnitureShops.Find(id);

            if (furnitureShop == null)
            {
                return(HttpNotFound());
            }
            return(View(furnitureShop));
        }
예제 #6
0
 public IActionResult Search([Bind("ShopId")] FurnitureShop shop)
 {
     return(RedirectToAction("IndexSingle", new { shopId = shop.ShopId }));
 }