public override void OnAuthorization(AuthorizationContext filterContext) { if (!filterContext.HttpContext.Request.IsAuthenticated) { filterContext.Result = new RedirectToRouteResult( new System.Web.Routing.RouteValueDictionary( new { controller = "users", action = "login" })); } else { int jobPostingId = 0; Int32.TryParse(HttpContext.Current.Request.Url.Segments[2].TrimEnd('/'), out jobPostingId); JobPostingService _jobPosting = new JobPostingService(); JobPosting jp = _jobPosting.SelectById(jobPostingId); int companyId = jp.CompanyId; string userId = HttpContext.Current.User.Identity.GetUserId(); if (CompanyPersonService.Verify(companyId, userId)) { base.OnAuthorization(filterContext); } else { filterContext.Result = new RedirectToRouteResult( new System.Web.Routing.RouteValueDictionary( new { controller = "jobpostings", action = jobPostingId })); } } }
public JobPostingController(IJobPostingRepository JobPostingRepository) { _JobPostingService = new JobPostingService(JobPostingRepository); }
public JobPostingServiceTest() { client = new MongoClient(MONGODB_TEST_CONNECTION_STRING); jps = new JobPostingService(client); }
public JobPostingManager(MongoClient _db) { _jobPostingService = new JobPostingService(_db); _jobAppService = new JobApplicationService(_db); }