public void SaveShowedProduct(ShowedProduct showedProduct)
 {
     if (showedProduct.showedProductID == 0)
     {
         _db.ShowedProducts.Add(showedProduct);
     }
     else
     {
         var dbEntry = _db.ShowedProducts.Find(showedProduct.showedProductID);
         if (dbEntry != null)
         {
             dbEntry.productID = showedProduct.productID;
             dbEntry.userID = showedProduct.userID;
         }
     }
     _db.SaveChanges();
 }
        public ActionResult EditShowedProduct(ShowedProduct showedProduct)
        {
            if (ModelState.IsValid)
            {
                repository.SaveShowedProduct(showedProduct);
                TempData["message"] = string.Format("Показаний товар {0} було збережено!", showedProduct.showedProductID);

                return RedirectToAction("ShowedProductsList");
            }
            else
            {
                return View(showedProduct);
            }
        }