I have another controller named ApplicantController in that I have index page so that page I want to access agter login only or it should redirect to login page.
ApplicantController
public ActionResult Index()
{
var data = conn.applicants.ToList();
ViewBag.applicantdetails = data;
DateTime cretedat = DateTime.Now;
using (cams20Entities db = new cams20Entities())
{
//.OrderByDescending(x => x.id).ThenByDescending(a => a.id
List <applicant> applicants = db.applicants.ToList();
List<dept> depts = db.depts.ToList();
List<app> apps = db.apps.ToList();
DateTime date = DateTime.Today;
var Recordsall = (from e in applicants
join d in depts on e.DEPT_NO equals d.DEPT_NO into table1
from d in table1.ToList()
join a in apps on e.APP_CODE equals a.APP_CODE into table2
from a in table2.ToList()
select new applicant
{
DEPT_NO = e.DEPT_NO,
DEPT_NAME = d.DEPT_NAME,
ack_no = e.ack_no,
name = e.name,
id = e.id,
APP_TYPE = a.APP_TYPE,
appdate = e.appdate,
remarks = e.remarks,
street = e.street,
village = e.village,
town = e.town,
pincode = e.pincode,
created_at = e.created_at
});
//return View(Recordsall);
var repListTbl = Recordsall.OrderByDescending(x => x.id).ToList();
return View(repListTbl);
}
}