示例#1
0
        public ActionResult Create(Agent agent)
        {
            if (ModelState.IsValid)
            {
                db.Agent.Add(agent);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(agent);
        }
示例#2
0
 public ActionResult Edit(Agent agent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(agent).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(agent);
 }