我的系统有问题。根据我们创建新数据时的要求,数据状态= 1.当我们删除数据状态= 0.编辑数据时,数据状态必须是1,但在我的情况下数据状态= 0.我希望你能帮助我。谢谢抱歉我的英文不好
public ActionResult Create()
{
return View();
}
[HttpPost]
public ActionResult Create(m_design m_design)
{
if (ModelState.IsValid)
{
m_design.design_status = 1;
db.m_design.Add(m_design);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(m_design);
}
public ActionResult Edit(int id)
{
m_design m_design = db.m_design.Find(id);
if (m_design == null)
{
return HttpNotFound();
}
return View(m_design);
}
[HttpPost]
public ActionResult Edit(m_design m_design)
{
if (ModelState.IsValid)
{
db.Entry(m_design).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(m_design);
}
public ActionResult Delete(int id)
{
string msg = string.Empty;
msg = "data berhasil di delete";
return Json(new { success = true, resultText = "Data has been deleted." });
}
[HttpPost, ActionName("Delete")]
public ActionResult DeleteConfirmed(int id)
{
m_design m_design = db.m_design.Find(id);
m_design.design_status = 0;
db.Entry(m_design).State = EntityState.Modified;
db.SaveChanges();
return Json(new { success = true, resultText = "Data has been deleted." });
}