public ActionResult <EmployerVM> ProfilePost([FromBody] EmployerVM employer)
        {
            Employer   existingEmployer = null;
            EmployerVM newEmployer      = null;

            existingEmployer = findEmployerBySubjectOrEmail();
            // If
            if (existingEmployer != null)
            {
                return(Conflict());
            }

            var domain = map.Map <EmployerVM, Employer>(employer);

            domain.onlineSigninID = UserSubject;
            if (UserEmail != null)
            {
                domain.email = UserEmail;
            }
            try
            {
                newEmployer = map.Map <Employer, EmployerVM>(serv.Create(domain, UserEmail));
            }
            // catch (DbExpception e) {

            // }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
            return(Ok(new { data = newEmployer }));
        }
Example #2
0
        public async Task <JsonResult> Create(Employer employer, string userName)
        {
            ModelState.ThrowIfInvalid();

            var modelIsValid = await _adaptor.TryUpdateModelAsync(this, employer);

            if (modelIsValid)
            {
                var saved  = _serv.Create(employer, userName);
                var result = _map.Map <Employer, ViewModel.Employer>(saved);
                return(Json(new {
                    sNewRef = result.tabref,
                    sNewLabel = result.tablabel,
                    iNewID = result.ID,
                    jobSuccess = true
                }));
            }
            else
            {
                return(Json(new {
                    jobSuccess = false,
                    rtnMessage = $"{ModelState.GetErrorMessageIfInvalid()}"
                }));
            }
        }
Example #3
0
        // TODO registration
        public async Task Register(EmployerCreateDto employer)
        {
            using (var unitOfWork = UnitOfWorkProvider.Create())
            {
                await employerService.Create(employer);

                await unitOfWork.Commit();
            }
        }
        public JsonResult Create(Employer employer, string userName)
        {
            UpdateModel(employer);
            Employer newEmployer = serv.Create(employer, userName);
            var      result      = map.Map <Employer, ViewModel.Employer>(newEmployer);

            return(Json(new
            {
                sNewRef = result.tabref,
                sNewLabel = result.tablabel,
                iNewID = result.ID,
                jobSuccess = true
            }));
        }
Example #5
0
        public JsonResult Create(Domain.Employer employer, string userName)
        {
            UpdateModel(employer);
            Domain.Employer newEmployer = serv.Create(employer, userName);
            var             result      = map.Map <Domain.Employer, ViewModel.Employer>(newEmployer);

            return(Json(new
            {
                sNewRef = result.tabref,
                sNewLabel = result.tablabel,
                iNewID = result.ID,
                jobSuccess = true
            },
                        JsonRequestBehavior.AllowGet));
        }
Example #6
0
 public void AddEmployer(DateTime?datecreated = null,
                         DateTime?dateupdated = null)
 {
     //
     // DEPENDENCIES
     _servE = container.GetRequiredService <IEmployerService>();
     //
     // ARRANGE
     _emp = (Employer)Records.employer.Clone();
     if (datecreated != null)
     {
         _emp.datecreated = (DateTime)datecreated;
     }
     if (dateupdated != null)
     {
         _emp.dateupdated = (DateTime)dateupdated;
     }
     //
     // ACT
     _servE.Create(_emp, _user);
 }
Example #7
0
 public FluentRecordBase AddEmployer(
     DateTime?datecreated = null,
     DateTime?dateupdated = null
     )
 {
     //
     // DEPENDENCIES
     _servE = container.Resolve <IEmployerService>();
     //
     // ARRANGE
     _emp = (Employer)Records.employer.Clone();
     if (datecreated != null)
     {
         _emp.datecreated = (DateTime)datecreated;
     }
     if (dateupdated != null)
     {
         _emp.dateupdated = (DateTime)dateupdated;
     }
     //
     // ACT
     _servE.Create(_emp, _user);
     return(this);
 }
Example #8
0
        public void Post([FromBody] ViewModel.Employer employer)
        {
            var domain = map.Map <ViewModel.Employer, Domain.Employer>(employer);

            serv.Create(domain, userEmail);
        }
Example #9
0
        public void Post([FromBody] EmployerViewModel employer)
        {
            var domain = map.Map <EmployerViewModel, Domain.Employer>(employer);

            serv.Create(domain, UserEmail);
        }
        public async Task <CreateEntityResponse> Create([FromBody] CreateEmployerRequest employer)
        {
            var employerId = await _employerService.Create(employer);

            return(employerId);
        }