Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public static TopTenEdit GetModelView(TopTen topTen)
        {
            if (topTen == null)
                return null;

            var topTenEdit = new TopTenEdit(topTen);
            return topTenEdit;
        }
Ejemplo n.º 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);
        }