public ActionResult DeletePosition(int id, FormCollection collection) { TechCareerFair.DAL.PositionDAL.PositionRepository pr = new DAL.PositionDAL.PositionRepository(); position position = pr.SelectOne(id); int businessID = position.Business; pr.Delete(id); return(RedirectToAction("ListPositions", new { id = businessID })); }
public ActionResult DeletePosition(int id, FormCollection collection, string businessEmail) { if (businessEmail == User.Identity.GetUserName()) { TechCareerFair.DAL.PositionDAL.PositionRepository pr = new DAL.PositionDAL.PositionRepository(); position position = pr.SelectOne(id); int businessID = position.Business; pr.Delete(id); return(RedirectToAction("ListPositions", new { id = businessID })); } else { return(RedirectToAction("AccessDenied", "Error")); } }