public ActionResult Create(TopTenEdit topTenEdit) { if (ModelState.IsValid) { TopTen topTen = topTenEdit.GetModel(); TopTenCache.Insert(Db, UserId, ref topTen); return RedirectToAction("Index"); } PopulateToUserId(topTenEdit.ToUserId); PopulateStatus(topTenEdit.Status); return View(topTenEdit); }
public static TopTenEdit GetModelView(TopTen topTen) { if (topTen == null) return null; var topTenEdit = new TopTenEdit(topTen); return topTenEdit; }
public ActionResult Edit(TopTenEdit topTenEdit) { if (ModelState.IsValid) { TopTen topTen = topTenEdit.GetModel(); bool success = TopTenCache.Update(Db, UserId, ref topTen); if (!success) { return RedirectToAccessDenied(); } return RedirectToAction("Index"); } return View(topTenEdit); }