I have an sms sms application, which has different templates that users can use to send their SMSs, I used different view to represent different templates, however I want to use one action method to send an SMS, i might be different templates but at the end of the day user will send an sms which has two parameters, message itself and cell number to which this sms is to be send to,
Here is my 3 templates for now
[HttpGet]
public ActionResult BookingServiceReminder()
{
return View();
}
[HttpGet]
public ActionResult ServiceReminder()
{
return View();
}
[HttpGet]
public ActionResult DetailedReminder()
{
return View();
}
[HttpPost]
public ActionResult SendSMS(string message, string cellNumber)
{
if (_dbManager.SendSMS(cellNumber, message, User.Identity.Name))
{
TempData["Success"] = "Message was successfully sent";
}
else
{
TempData["Error"] = "An error occured while sending the message";
}
return RedirectToAction("BookingServiceReminder");
}
My question is, is there a way of using one method for all this views, I dont want to have multiple post methods which will almost have same code except the redirectToAction on which I want to return then current view(current template).