コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ListOfNationality listOfNationality = db.ListOfNationalities.Find(id);

            listOfNationality.Hide = true;
            //db.ListOfNationalities.Remove(listOfNationality);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ID,Hide,CreatedDate,Nationality")] ListOfNationality listOfNationality)
 {
     if (ModelState.IsValid)
     {
         db.Entry(listOfNationality).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(listOfNationality));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "ID,Hide,CreatedDate,Nationality")] ListOfNationality listOfNationality)
        {
            if (ModelState.IsValid)
            {
                listOfNationality.CreatedDate = DateTime.Now;
                db.ListOfNationalities.Add(listOfNationality);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(listOfNationality));
        }
コード例 #4
0
        // GET: ListOfNationalities/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ListOfNationality listOfNationality = db.ListOfNationalities.Find(id);

            if (listOfNationality == null)
            {
                return(HttpNotFound());
            }
            return(View(listOfNationality));
        }