public ActionResult Edit([Bind(Include = "ID,NanpreNO,MakeUserID,IsPublic,Title,Remarks")] Momo momo) { if (ModelState.IsValid) { momo.CreatedDateTime = DateTime.Now; var momoState = db.MomoStates.FirstOrDefault(x => x.Momo_ID == momo.ID); momoState.CurrentNanpre = db.NanpreQuestions.FirstOrDefault(x => x.NanpreNO == momo.NanpreNO).Nanpre; momo.IsCleared = false; db.Entry(momo).State = EntityState.Modified; db.Entry(momoState).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(momo)); }
public ActionResult Edit([Bind(Include = "ID,NanpreNO,MakeUserID,IsPublic,Title,Remarks")] Momo momo) { if (ModelState.IsValid) { db.Entry(momo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(momo)); }