Esempio n. 1
0
        // GET: /Regular/Create
        public ActionResult Create(int HHID, DateTime Date, int MemberId)
        {
            RegularViewModel vm = new RegularViewModel();

            //Creates the data needed for the Create Form
            vm.HHID = HHID;
            vm.MemberId = MemberId;
            vm.Date = Date;
            ViewBag.MemberList = memberList(HHID, null);
            ViewBag.KiawahLocation = GetAddressList(HHID, null);
            ViewBag.DriverId = new SelectList(db.Drivers, "Id", "Name");
            ViewBag.TripTypeId = new SelectList(db.TripTypes, "Id", "Name");
            ViewBag.VehicleId = new SelectList(db.Vehicles, "Id", "Name");
            return View(vm);
        }
Esempio n. 2
0
        // GET: /Regular/Edit/5
        public ActionResult Edit(int? id)
        {
            //check to be sure that the id is not null
            if (id == null) {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            //create the view model object and test to see if it is not null
            RegularViewModel vm = new RegularViewModel(id.Value);
            if (vm == null) {
                return HttpNotFound();
            }
            List<string> membersSelectedList = new List<string>();
            foreach (var member in vm.Members){
                membersSelectedList.Add(member.Id.ToString());
            }

            string[] selectedMembers = membersSelectedList.ToArray();

            if (vm.OtherAddress != null) {
                vm.KiawahLocation = "Other";
            }
            ViewBag.MemberList = memberList(vm.HHID, selectedMembers);
            ViewBag.KiawahLocation = GetAddressList(vm.HHID, vm.KiawahLocation);
            ViewBag.DriverId = new SelectList(db.Drivers, "Id", "Name", vm.DriverId);
            ViewBag.TripTypeId = new SelectList(db.TripTypes, "Id", "Name", vm.TripTypeId);
            ViewBag.VehicleId = new SelectList(db.Vehicles, "Id", "Name", vm.VehicleId);
            return View(vm);
        }