コード例 #1
0
        public ActionResult DeleteConfirmed(short id)
        {
            Adm_Agency adm_Agency = db.Adm_Agencies.Find(id);

            db.Adm_Agencies.Remove(adm_Agency);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ID,Agency")] Adm_Agency adm_Agency)
 {
     if (ModelState.IsValid)
     {
         db.Entry(adm_Agency).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(adm_Agency));
 }
コード例 #3
0
        // GET: Adm_Agency/Details/5
        public ActionResult Details(short?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Adm_Agency adm_Agency = db.Adm_Agencies.Find(id);

            if (adm_Agency == null)
            {
                return(HttpNotFound());
            }
            return(View(adm_Agency));
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "ID,Agency")] Adm_Agency adm_Agency)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Debug.WriteLine("This is the id: " + adm_Agency.ID);
                    db.Adm_Agencies.Add(adm_Agency);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch (Exception e)
                {
                    ModelState.AddModelError(string.Empty, e.Message);
                    return(View(adm_Agency));
                }
            }

            return(View(adm_Agency));
        }