public void deleteObject()
{
try
{
var oList =
from o in dbpollContext.POLL_OBJECTS_DFLT
where o.O_ID == obid
select o;
POLL_OBJECTS_DFLT ob = oList.First<POLL_OBJECTS_DFLT>();
dbpollContext.DeleteObject(ob);
dbpollContext.SaveChanges();
}
catch (Exception e)
{
throw (e);
}
}
public ActionResult Delete(int objectid, int pollid) { if (Session["uid"] == null || Session["uid"].ToString().Equals("")) { return RedirectToAction("Index", "Home"); } if ((int)Session["user_type"] < User_Type.POLL_CREATOR) { return RedirectToAction("Invalid", "Home"); } pollObjectModel ob = new pollObjectModel(objectid); ob.deleteObject(); return RedirectToAction("Index", "PollObject", new { pollid = pollid, pollname = ViewData["pollname"] }); }