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 })); }
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()}" })); } }
// 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 })); }
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)); }
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); }
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); }
public void Post([FromBody] ViewModel.Employer employer) { var domain = map.Map <ViewModel.Employer, Domain.Employer>(employer); serv.Create(domain, userEmail); }
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); }