public ActionResult Create(TinhTrangModel pTinhTrangModel)
 {
     if (ModelState.IsValid)
     {
         db.TinhTrangs.AddObject(new TinhTrang() { TenTinhTrang = pTinhTrangModel.TenTinhTrang });
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View();
 }
        public ActionResult Edit(TinhTrangModel model)
        {
            if (ModelState.IsValid)
            {
                TinhTrang tinhtrang = db.TinhTrangs.Single(m => m.MaTinhTrang == model.MaTinhTrang);
                tinhtrang.TenTinhTrang = model.TenTinhTrang;

                db.ObjectStateManager.ChangeObjectState(tinhtrang, System.Data.EntityState.Modified);
                db.SaveChanges();

                return RedirectToAction("Index");
            }
            return View(model);
        }
 //
 // GET: /TinhTrang/Edit/5
 public ActionResult Edit(int id)
 {
     TinhTrangModel tinhtrang = new TinhTrangModel() { MaTinhTrang = id, TenTinhTrang = db.TinhTrangs.Single(m => m.MaTinhTrang == id).TenTinhTrang };
     return View(tinhtrang);
 }