Beispiel #1
0
        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);
        }
Beispiel #2
0
        public static TopTenEdit GetModelView(TopTen topTen)
        {
            if (topTen == null)
                return null;

            var topTenEdit = new TopTenEdit(topTen);
            return topTenEdit;
        }
Beispiel #3
0
        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);
        }