daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public interface IContactSubmitter
  2. {
  3.     void SubmitContact(string message);
  4. }
  5.  
  6. public class ContactController : Controller
  7. {
  8.     private readonly IContactSubmitter _contactSubmitter;
  9.     public ContactController(IContactSubmitter contactSubmitter)
  10.     {
  11.         _contactSubmitter = contactSubmitter;
  12.     }
  13.  
  14.     [HttpPost]
  15.     public ViewResult Contact(string message)
  16.     {
  17.         // Pretend there was some validation done here..
  18.         if (ValidateMessage(message))
  19.             _contactSubmitter.SubmitContact(message);
  20.  
  21.         return View();
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top