public ActionResult delete(int id)
{
MessageTemplateRepository m_rep = new MessageTemplateRepository();
MessageTemplate m = new MessageTemplate();
//GET Committee
try
{
m = m_rep.getById(id);
}
catch (Exception exception)
{
//IF THERE IS A MESS UP, RETURN ERROR TO FRONT
TempData["flash"] = "Unable to retrieve message: " + exception.Message;
return RedirectToAction("Index");
}
//DELETE Committee
try
{
m_rep.delete(m);
TempData["flash"] = "Deleted message.";
return RedirectToAction("Index");
}
catch (Exception exception)
{
TempData["flash"] = "Unable to delete message: " + exception.Message;
return RedirectToAction("Index");
}
}