Example #1
0
        public ActionResult BannedProduct(int productId)
        {
            var bannedAccount = new BannedProducts();

            var product = _context.Products.FirstOrDefault(a => a.Id == productId);

            bannedAccount.ProductId = productId;
            bannedAccount.Product   = product;


            return(View(bannedAccount));
        }
Example #2
0
        public ActionResult BannedProduct(int productId, string reason)
        {
            var bannedProducts = new BannedProducts()
            {
                ProductId = productId,
                Reason    = reason
            };

            _context.BannedProducts.Add(bannedProducts);
            _context.SaveChanges();

            messageScreen.Typr    = "true";
            messageScreen.Content = "تم حضر المنتج بنجاح";
            messageScreen.Action  = "Products";
            messageScreen.Control = "Admin";

            return(RedirectToAction("Index", "Message", messageScreen));
        }