// GET: PageAdmin/Delete/5
        public ActionResult Delete(short id)
        {
            var model = new PageModel();

            using (var repo = new PagesRepository())
            {
                var entity = repo.GetById(id);

                model.Id      = id;
                model.Url     = entity.Url;
                model.Monitor = entity.Monitor;

            }

            return View(model);
        }
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var model = new PageModel();
                UpdateModel(model);

                var entity = new Page {Monitor = model.Monitor, Url = model.Url};

                using (var repo = new PagesRepository())
                {
                    repo.Add(entity);
                    repo.SaveChanges();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                var model = new PageModel();

                UpdateModel(model);

                using (var repo = new PagesRepository())
                {
                    var entity = repo.GetById(model.Id);

                    entity.Url     = model.Url;
                    entity.Monitor = model.Monitor;

                    repo.SaveChanges();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }