Пример #1
0
        public ActionResult Edit(int id, string content, string url)
        {
            if (id <= 0)
            {
                ViewBag.ErrorMessage = "消息编码错误";
                return this.View("ShowError");
            }

            try
            {
                var service = new MessageService();
                var originalMsg = service.Single(id);

                if (originalMsg == null)
                {
                    ViewBag.ErrorMessage = "消息编码错误";
                    return this.View("ShowError");
                }

                originalMsg.Message1 = content;
                originalMsg.PicUrl = url;

                service.Update(originalMsg);

                return this.RedirectToAction("Index");
            }
            catch (Exception exception)
            {
                ViewBag.ErrorMessage = exception.InnerException;
                return this.View("ShowError");
            }
        }
Пример #2
0
        public ActionResult Remove(int id)
        {
            if (id <= 0)
            {
                ViewBag.ErrorMessage = "消息编码错误";
                return this.View("ShowError");
            }

            try
            {
                var service = new MessageService();
                var originalMsg = service.Single(id);

                if (originalMsg == null)
                {
                    ViewBag.ErrorMessage = "消息编码错误";
                    return this.View("ShowError");
                }

                originalMsg.State = 127;

                service.Update(originalMsg);

                return this.RedirectToAction("Index");
            }
            catch (Exception exception)
            {
                ViewBag.ErrorMessage = exception.InnerException;
                return this.View("ShowError");
            }
        }