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 }));
         }
     }
 }
Exemplo n.º 2
0
 public JobPostingController(IJobPostingRepository JobPostingRepository)
 {
     _JobPostingService = new JobPostingService(JobPostingRepository);
 }
Exemplo n.º 3
0
 public JobPostingServiceTest()
 {
     client = new MongoClient(MONGODB_TEST_CONNECTION_STRING);
     jps    = new JobPostingService(client);
 }
Exemplo n.º 4
0
 public JobPostingManager(MongoClient _db)
 {
     _jobPostingService = new JobPostingService(_db);
     _jobAppService     = new JobApplicationService(_db);
 }