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

            db.associate.Remove(associate);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "age,full_name,position,associate_id")] associate associate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(associate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(associate));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "age,full_name,position,associate_id")] associate associate)
        {
            if (ModelState.IsValid)
            {
                db.associate.Add(associate);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(associate));
        }
コード例 #4
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            associate associate = db.associate.Find(id);

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