コード例 #1
0
        public ActionResult MessageSubmit(MessageInfoSummaryViewModel messageInfo)
        {
            MessageInfo messages = new MessageInfo
            {
                Name = messageInfo.Name,
                Email = messageInfo.Email,
                Content = messageInfo.Content,
                CreateDate = DateTime.Now
            };

            db.MessageInfo.Add(messages);
            db.SaveChanges();

            return RedirectToAction("Contact");
        }
コード例 #2
0
ファイル: AdminController.cs プロジェクト: nikkiLuan/Jiuding
        public ActionResult MessageDelete(MessageInfoSummaryViewModel messageInfo)
        {
            var MessageInfo = db.MessageInfo.Find(messageInfo.ID);

            db.MessageInfo.Remove(MessageInfo);
            db.SaveChanges();

            return RedirectToAction("MessageInfo");
        }
コード例 #3
0
ファイル: AdminController.cs プロジェクト: nikkiLuan/Jiuding
        public ActionResult MessageDeleteConfirm(int id)
        {
            var MessageInfo = db.MessageInfo.Find(id);

            MessageInfoSummaryViewModel messageInfo = new MessageInfoSummaryViewModel
            {
                Name = MessageInfo.Name,
                Email = MessageInfo.Email,
                Content = MessageInfo.Content,
                CreateDate = MessageInfo.CreateDate.ToString()
            };

            return View(messageInfo);
        }
コード例 #4
0
ファイル: AdminController.cs プロジェクト: nikkiLuan/Jiuding
        public ActionResult MessageInfo()
        {
            var messageInfo = db.MessageInfo.ToList();

            List<MessageInfoSummaryViewModel> message_sm = new List<MessageInfoSummaryViewModel>();

            foreach (var item in messageInfo)
            {
                MessageInfoSummaryViewModel _messageInfo = new MessageInfoSummaryViewModel
                {
                    ID = item.ID,
                    Name = item.Name,
                    Email = item.Email,
                    Content = item.Content,
                    CreateDate = item.CreateDate.ToString()
                };
                message_sm.Add(_messageInfo);
            }
            return View(message_sm);
        }