Exemple #1
0
        public ActionResult CreateRateGroup([Bind(Include = "Id,RateGroupId,CarRatePackageId")] CarRateGroup carRateGroup)
        {
            if (ModelState.IsValid && carRateGroup.RateGroupId != 0 && carRateGroup.CarRatePackageId != 0)
            {
                db.CarRateGroups.Add(carRateGroup);
                db.SaveChanges();
                return(RedirectToAction("CarRateGroupList", new { rateGroupId = carRateGroup.RateGroupId }));
            }

            return(View(carRateGroup));
        }
Exemple #2
0
        //RateGroup Functions
        // GET: RateGroups/Create
        public ActionResult CreateRateGroup(int GroupId)
        {
            CarRateGroup rategroup = new CarRateGroup();

            rategroup.RateGroupId = GroupId;
            // ViewBag.RateGroupId = new SelectList(db.RateGroups, "Id", "GroupName", GroupId);
            // ViewBag.CarRatePackageId = new SelectList(db.CarRatePackages, "Id", "Description");
            ViewBag.RateGroupId        = GroupId;
            ViewBag.CarRatePackageList = db.CarRatePackages.ToList();
            return(View(rategroup));
        }
Exemple #3
0
        // GET: CarRateGroups/Delete/5
        public ActionResult RemoveItem(int itemId, int GroupId)
        {
            CarRateGroup carRateGroup = db.CarRateGroups.Find(itemId);

            if (carRateGroup == null)
            {
                return(HttpNotFound());
            }
            else
            {
                db.CarRateGroups.Remove(carRateGroup);
                db.SaveChanges();
            }
            return(RedirectToAction("CarRateGroupList", new { rateGroupId = GroupId }));
        }
Exemple #4
0
        public ActionResult AddToGroup(int id, int groupId)
        {
            CarRateGroup carRateGroup = new CarRateGroup();

            carRateGroup.CarRatePackageId = id;
            carRateGroup.RateGroupId      = groupId;

            if (ModelState.IsValid && id != 0 && groupId != 0)
            {
                db.CarRateGroups.Add(carRateGroup);
                db.SaveChanges();
                return(RedirectToAction("CarRateGroupList", new { rateGroupId = carRateGroup.RateGroupId }));
            }

            return(View(carRateGroup));
        }