Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            LocationCoupon locationcoupon = db.LocationCoupons.Find(id);

            db.LocationCoupons.Remove(locationcoupon);
            db.SaveChanges();
            return(RedirectToAction("Index", new { id = locationcoupon.LocationId }));
        }
Example #2
0
        public ActionResult Create(int id, LocationCoupon locationcoupon)
        {
            if (ModelState.IsValid)
            {
                locationcoupon.LocationId = id;
                db.LocationCoupons.Add(locationcoupon);
                db.SaveChanges();
                return(RedirectToAction("Index", new { id = id }));
            }

            ViewBag.LocationId = id;
            var offers = from s in db.Service
                         where !(from fs in db.LocationServices
                                 where (fs.LocationId == id)
                                 select fs.ServiceId).Contains(s.ServiceId)
                         select s;

            ViewBag.OffersCount = offers.Count();
            ViewBag.OfferId     = new SelectList(offers, "OfferId", "Title", locationcoupon.OfferId);
            return(View(locationcoupon));
        }
Example #3
0
        ////
        //// GET: /Admin/ManagedCoupons/Edit/5

        //public ActionResult Edit(int id)
        //{
        //    LocationCoupon locationcoupon = db.LocationCoupons.Find(id);
        //    ViewBag.LocationId = new SelectList(db.Location, "LocationId", "LocationName", locationcoupon.LocationId);
        //    ViewBag.OfferId = new SelectList(db.Offer, "OfferId", "Title", locationcoupon.OfferId);
        //    return View(locationcoupon);
        //}

        ////
        //// POST: /Admin/ManagedCoupons/Edit/5

        //[HttpPost]
        //public ActionResult Edit(LocationCoupon locationcoupon)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.Entry(locationcoupon).State = EntityState.Modified;
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }
        //    ViewBag.LocationId = new SelectList(db.Location, "LocationId", "LocationName", locationcoupon.LocationId);
        //    ViewBag.OfferId = new SelectList(db.Offer, "OfferId", "Title", locationcoupon.OfferId);
        //    return View(locationcoupon);
        //}

        //
        // GET: /Admin/ManagedCoupons/Delete/5

        public ActionResult Delete(int id)
        {
            LocationCoupon locationcoupon = db.LocationCoupons.Find(id);

            return(View(locationcoupon));
        }