예제 #1
0
        public ActionResult Create([Bind(Include = "RegionID,Name,CountryID,isDeleted,DateInsert,DateUpdate")] Region region)
        {
            if (ModelState.IsValid)
            {
                db.Regions.Add(region);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "Name", region.CountryID);
            return(View(region));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "VolunteerID,FirstName,LastName,DateOfBirth,MobileNo,PhoneNo,Email,Password,ImagePath,DateRegister,RegionID,StatusID,DateInsert,DateUpdate")] Volunteer volunteer)
        {
            if (ModelState.IsValid)
            {
                db.Volunteers.Add(volunteer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.RegionID = new SelectList(db.Regions, "RegionID", "Name", volunteer.RegionID);
            ViewBag.StatusID = new SelectList(db.Status, "StatusID", "Name", volunteer.StatusID);
            return(View(volunteer));
        }