public async Task <ActionResult> Post(EducationCreateInputModel input)
        {
            // var userId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value;
            var user = await this.userManager.GetUserAsync(this.User);

            var inputId = await this.educationsService.CreateAsync(input, user.Id);

            var model = await this.educationsService.GetByIdAsync <EducationExportModel>(inputId);

            return(this.CreatedAtAction(nameof(this.GetById), new { id = model.Id }, model));
        }
示例#2
0
        public async Task <IActionResult> Create(EducationCreateInputModel input)
        {
            var defaultCvId = _cvService.GetId();

            if (!ModelState.IsValid)
            {
                return(View(input));
            }

            try
            {
                await _educationService.CreateAsync(input, defaultCvId);
            }
            catch (Exception e)
            {
                _logger.LogError(e, "An exception occured during new education record creation.");
                return(RedirectToAction("Error", "Home"));
            }

            return(RedirectToAction("Index", "Home"));
        }
        public async Task <int> CreateAsync(EducationCreateInputModel input, string userId)
        {
            // var userEntity = this.usersRepository.AllAsNoTracking()
            //   .FirstOrDefault(x => x.UserName == articleInputModel.UserId);
            //// take the user and record its id in the article, product, conformity, etc.
            var entity = new Education
            {
                Degree        = input.Degree.Trim(),
                Speciality    = input.Speciality.Trim(),
                Institution   = input.Institution.Trim(),
                StartYear     = input.StartYear,
                EndYear       = input.EndYear,
                IconClassName = input.IconClassName.Trim(),
                Details       = input.Details.Trim(),
                UserId        = userId,
            };

            await this.educationsRepository.AddAsync(entity);

            await this.educationsRepository.SaveChangesAsync();

            return(entity.Id);
        }
示例#4
0
        public IActionResult Create()
        {
            var viewModel = new EducationCreateInputModel();

            return(View(viewModel));
        }