예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CountryInGroup countryInGroup = db.CountryInGroups.Find(id);

            db.CountryInGroups.Remove(countryInGroup);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "Country_Id,Group_Id,WC_Id")] CountryInGroup countryInGroup)
 {
     if (ModelState.IsValid)
     {
         db.Entry(countryInGroup).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Country_Id = new SelectList(db.Countries, "Country_Id", "Name", countryInGroup.Country_Id);
     ViewBag.Group_Id   = new SelectList(db.Groups, "Group_Id", "Name", countryInGroup.Group_Id);
     ViewBag.WC_Id      = new SelectList(db.WorldCups, "WC_Id", "Location", countryInGroup.WC_Id);
     return(View(countryInGroup));
 }
예제 #3
0
        // GET: CountryInGroups/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CountryInGroup countryInGroup = db.CountryInGroups.Find(id);

            if (countryInGroup == null)
            {
                return(HttpNotFound());
            }
            return(View(countryInGroup));
        }
예제 #4
0
        // GET: CountryInGroups/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CountryInGroup countryInGroup = db.CountryInGroups.Find(id);

            if (countryInGroup == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Country_Id = new SelectList(db.Countries, "Country_Id", "Name", countryInGroup.Country_Id);
            ViewBag.Group_Id   = new SelectList(db.Groups, "Group_Id", "Name", countryInGroup.Group_Id);
            ViewBag.WC_Id      = new SelectList(db.WorldCups, "WC_Id", "Location", countryInGroup.WC_Id);
            return(View(countryInGroup));
        }
        private void LoadCollectionWithGroups(List<Country> listOfCountries)
        {
            listOfCountries.Sort(Country.CompareByName);

            var groups = new Dictionary<string, CountryInGroup>();

            foreach (char c in Groups)
            {
                var group = new CountryInGroup(c.ToString(CultureInfo.InvariantCulture));
                Countries.Add(group);
                groups[c.ToString(CultureInfo.InvariantCulture)] = group;
            }

            foreach (var item in listOfCountries)
            {
                groups[Country.GetCountryKey(item)].Add(item);
            }
        }