public ActionResult Edit(About about) { if (ModelState.IsValid) { abouts.SaveAbout(about); TempData["message"] = string.Format("About details have been saved"); return RedirectToAction("Index"); } else { //there is something wrong with the data vaues return View(); } }
public void SaveAbout(About about) { if (about.AboutID == 0) { context.Abouts.Add(about); } else { About dbEntry = context.Abouts.Find(about.AboutID); if (dbEntry != null) { dbEntry.AboutText = about.AboutText; } } context.SaveChanges(); }