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); }
public ActionResult DeleteConfirmed(int id) { UserMessage userMessage = userMessageRepository.GetUserMessageById(id); userMessageRepository.DeleteUserMessage(userMessage); userMessageRepository.Save(); return(RedirectToAction("Index")); }
public void SaveMessage(string inputstring) { var inputstringPair = inputstring.Split(':'); var userMessage = new UserMessage(inputstringPair[0], inputstringPair[1]); repository.Save(userMessage); }
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)); }