コード例 #1
0
        public void CanSaveAndThenRetrieveANewUsersMessage()
        {
            var userName = "******";
            var message  = "Ground control to Major Tom";

            subject.Save(new UserMessage(userName, message));

            var messages = subject.GetMessages(userName);


            Assert.AreEqual(message, messages[0].Text);
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            UserMessage userMessage = userMessageRepository.GetUserMessageById(id);

            userMessageRepository.DeleteUserMessage(userMessage);
            userMessageRepository.Save();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public void SaveMessage(string inputstring)
        {
            var inputstringPair = inputstring.Split(':');

            var userMessage = new UserMessage(inputstringPair[0], inputstringPair[1]);

            repository.Save(userMessage);
        }
コード例 #4
0
 public ActionResult Messages([Bind(Include = "MessageID,Name,Email,Subject,Text")] UserMessage userMessage)
 {
     if (ModelState.IsValid)
     {
         userMessageRepository.InsertUserMessage(userMessage);
         userMessageRepository.Save();
         return(RedirectToAction("Messages"));
     }
     return(View(userMessage));
 }