Beispiel #1
0
        public ActionResult PersistRowOrder(FormCollection form)
        {
            int i = 0;

            foreach (string s in form["ids[]"].Split(",".ToCharArray()))
            {
                int id;
                if (Int32.TryParse(s, out id))
                {
                    var row = ModRepository.GetRowById(id);
                    row.SortIndex = i++;
                }
            }

            ModRepository.Save();

            return(Json(new { }));
        }
Beispiel #2
0
        public ActionResult Delete(int id)
        {
            Row row = ModRepository.GetRowById(id);

            if (row == null)
            {
                TempData["Message"] = "Registro não encontrado.";

                return(RedirectToAction("List"));
            }

            ModRepository.DeleteObject(row);

            ModRepository.Save();

            TempData["Message"] = "Registro removido com sucesso.";
            return(RedirectToAction("List"));
        }