Beispiel #1
0
        public ActionResult Edit(int id)
        {
            var m = map.Map <Domain.Employer, ViewModel.Employer>(serv.Get(id));

            m.def = def;
            return(PartialView("Edit", m));
        }
Beispiel #2
0
        public async Task <ActionResult> Edit(int id)
        {
            var e = _serv.Get(id);
            var m = _map.Map <Employer, ViewModel.Employer>(e);

            m.def = _defaults;
            return(await Task.Run(() => PartialView("Edit", m)));
        }
Beispiel #3
0
        public IHttpActionResult Get(int id)
        {
            var result = map.Map <Domain.Employer, ViewModel.Employer>(serv.Get(id));

            if (result == null)
            {
                return(NotFound());
            }

            return(Json(new { data = result }));
        }
        public Employer findEmployerBySubjectOrEmail()
        {
            var currentEmployer = serv.Get(UserSubject);

            if (currentEmployer != null)
            {
                return(currentEmployer);
            }
            if (UserEmail != null)
            {
                // If SingleOrDefault, then ~500 users will fail to login.
                // Need solution to de-duplicating employers before getting
                // string on emails duplication
                currentEmployer = serv.GetMany(em => em.email == UserEmail).OrderByDescending(em => em.dateupdated)
                                  .FirstOrDefault();
                return(currentEmployer);
            }

            return(currentEmployer);

            // legacy accounts wont have an email; comes from a claim
            // if we haven't found by userSubject, and userEmail is null, assume it's a
            // legacy account. Legacy accounts have self-attested emails for userNames
        }
Beispiel #5
0
        protected override void Initialize(HttpControllerContext controllerContext)
        {
            // base executes first to populate userSubject
            base.Initialize(controllerContext);

            employer = eServ.Get(guid: userSubject);
            if (employer == null)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)
                {
                    Content      = new StringContent(string.Format("No employer record associated with claim {0}", userSubject)),
                    ReasonPhrase = "Not found: employer record"
                });
            }
            paypalId     = cServ.getConfig(Cfg.PaypalId);
            paypalSecret = cServ.getConfig(Cfg.PaypalSecret);
            paypalUrl    = cServ.getConfig(Cfg.PaypalUrl);
        }