public ActionResult AuctionAlert(string HomeDecor, string Antiques, string Painting, string GovernmentProduct)
        {
            AuctionAlert re1 = new AuctionAlert();

            ViewBag.success = 0;
            TempData["msg"] = "<script>alert('Auction Alert Created Successfully.');</script>";
            if (Request.Form["submit"] != null)
            {
                String user = (string)(Session["log"]);
                String a    = "";
                var    r    = db.reg.Where(v => v.UserName.Equals(user));
                foreach (var item in r)
                {
                    a = item.Email;
                }


                if (HomeDecor != null)
                {
                    re1.Email             = a;
                    re1.UserName          = user;
                    re1.FavouriteCategory = HomeDecor;
                    db.alerts.Add(re1);
                    db.SaveChanges();
                    ViewBag.success = 1;
                }
                if (Antiques != null)
                {
                    re1.Email             = a;
                    re1.UserName          = user;
                    re1.FavouriteCategory = Antiques;
                    db.alerts.Add(re1);
                    db.SaveChanges();
                    ViewBag.success = 1;
                }
                if (Painting != null)
                {
                    re1.Email             = a;
                    re1.UserName          = user;
                    re1.FavouriteCategory = Painting;
                    db.alerts.Add(re1);
                    db.SaveChanges();
                    ViewBag.success = 1;
                }

                if (GovernmentProduct != null)
                {
                    re1.Email             = a;
                    re1.UserName          = user;
                    re1.FavouriteCategory = GovernmentProduct;
                    db.alerts.Add(re1);
                    db.SaveChanges();
                    ViewBag.success = 1;
                }
            }

            return(View());
        }
Example #2
0
        public ActionResult DeleteAlert(int id)
        {
            AuctionAlert aa = db.alerts.Find(id);

            if (aa != null)
            {
                db.alerts.Remove(aa);
                db.SaveChanges();
            }

            return(RedirectToAction("AuctionAlert1"));
        }