public async Task <IActionResult> OnPostCareerAsync() { if (!ModelState.IsValid) { return(Page()); } var user = await _userManager.GetUserAsync(User); if (user == null) { return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.")); } if (!await _userManager.IsInRoleAsync(user, Constants.Roles.Member)) { return(StatusCode(403)); } await LoadAsync(user); _careerLogService.Create(new CareerLog { Name = Form.CareerInput.CareerName, UserLogin = Username, EligibleForRecords = true, CareerLogMeta = CreateCareerLogMeta() }); StatusMessage = "A new career was created successfully"; return(RedirectToPage()); }
public async Task <IActionResult> OnPostAsync() { var user = await _userManager.GetUserAsync(User); if (user == null) { return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.")); } await LoadAsync(user); if (!ModelState.IsValid) { return(Page()); } _careerLogService.Create(new CareerLog { name = Input.CareerName, userLogin = Username }); StatusMessage = "A new career was created successfully"; return(RedirectToPage()); }
public ActionResult <CareerLog> CreateCareer(CareerLog log) { _telemetry.TrackEvent("CareerLogsController-CreateCareer", new Dictionary <string, string> { { nameof(CareerLog.name), log.name } }); log.userLogin = User.Identity.Name; CareerLog res = _careerLogService.Create(log); return(CreatedAtRoute("CreateCareer", res)); }
public ActionResult <CareerLogDto> CreateCareer(CareerLog log) { _telemetry.TrackEvent("CareerLogsController-CreateCareer", new Dictionary <string, string> { { nameof(CareerLog.name), log.name } }); if (!IsLocalhost) { return(Unauthorized()); } CareerLog res = _careerLogService.Create(log); return(CreatedAtRoute("CreateCareer", res)); }