Пример #1
0
        public ActionResult Delete(string id)
        {
            var db = new DataAccess();
            var model = new WikiModel();

            try
            {
                var page = db.GetPageByGuid(id);
                model.Guid = page.Guid;
                model.Author = db.GetUserById(page.Author).Full_name;
                model.CreatedOn = page.Created_on;
                model.ModifiedOn = page.Modified_on;
                model.Title = page.Title;
                model.Body = page.Body;
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;

                return View("Error");
            }

            return View(model);
        }
Пример #2
0
        public ActionResult Edit(string id)
        {
            var db = new DataAccess();

            if (!String.IsNullOrEmpty(id))
            {
                var page = db.GetPageByGuid(id);

                if (page != null)
                {
                    var model = new WikiModel()
                    {
                        Guid = page.Guid,
                        CreatedOn = page.Created_on,
                        ModifiedOn = page.Modified_on,
                        Author = db.GetUserById(page.Author).Full_name,
                        Title = page.Title,
                        Body = page.Body
                    };

                    return View(model);
                }
            }

            // We probably should have found the page unless somebody is tampering
            // or it was deleted prior to us getting here

            return RedirectToAction("Index");
        }