public ActionResult Create(HangSanXuat hangsanxuat) { if (ModelState.IsValid) { db.HangSanXuats.Add(hangsanxuat); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.MaQG = new SelectList(db.QuocGias, "MaQG", "TenQG", hangsanxuat.MaQG); return View(hangsanxuat); }
public ActionResult Edit(HangSanXuat hangsanxuat) { if (ModelState.IsValid) { db.Entry(hangsanxuat).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.MaQG = new SelectList(db.QuocGias, "MaQG", "TenQG", hangsanxuat.MaQG); return View(hangsanxuat); }