Check MVC code bellow. I have created this controller but i want to add a Model with this controller to Retrieve user email list and id. But problem is all online tutorial says create model during create controller since i already created controller i have to create model manually now. Please advice me any solution how can i Create model for this controller? Please also note i have to access that Model from "SubmitAction" method on this controller
namespace WebApplication2.Controllers
{
[AdministratorOnlyPermission]
public class EmailCampaignController : Controller
{
// GET: Email Campaign
public ActionResult Index()
{
return View();
}
public static IRestResponse SendSimpleMessage()
{
RestClient client = new RestClient();
client.BaseUrl = new Uri("https://api.mailgun.net/v3");
client.Authenticator =
new HttpBasicAuthenticator("api",
"key-34d6fd732e9ba43a2fakeeeeeee4b60c");
RestRequest request = new RestRequest();
request.AddParameter("domain", "sandboxc8436ac0db054b45986303cb8fd3944a.mailgun.org", ParameterType.UrlSegment);
request.Resource = "{domain}/messages";
request.AddParameter("from", "Excited User <[email protected]>");
request.AddParameter("to", "[email protected]");
request.AddParameter("subject", "Hello");
request.AddParameter("text", "Testing some Mailgun awesomness!");
request.Method = Method.POST;
return client.Execute(request);
}
[HttpPost]
public ActionResult SubmitAction(FormCollection collection)
{
//var userType = Request["userType"];
//var emailContent = Request["emailContent"];
//SendSimpleMessage();
//ViewBag.Message = "Hello " + Request["userType"];
}
}
}