Пример #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Applicant,CompanyName,CountryCode,Location,JobTitle,JobDescription,StartMonth,StartYear,EndMonth,EndYear,TimeStamp")] ApplicantWorkHistory applicantWorkHistory)
        {
            if (id != applicantWorkHistory.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(applicantWorkHistory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApplicantWorkHistoryExists(applicantWorkHistory.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Applicant"]   = new SelectList(_context.ApplicantProfiles, "Id", "Id", applicantWorkHistory.Applicant);
            ViewData["CountryCode"] = new SelectList(_context.SystemCountryCodes, "Code", "Code", applicantWorkHistory.CountryCode);
            return(View(applicantWorkHistory));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,Applicant,CompanyName,CountryCode,Location,JobTitle,JobDescription,StartMonth,StartYear,EndMonth,EndYear,TimeStamp")] ApplicantWorkHistory applicantWorkHistory)
        {
            if (ModelState.IsValid)
            {
                applicantWorkHistory.Id = Guid.NewGuid();
                _context.Add(applicantWorkHistory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Applicant"]   = new SelectList(_context.ApplicantProfiles, "Id", "Id", applicantWorkHistory.Applicant);
            ViewData["CountryCode"] = new SelectList(_context.SystemCountryCodes, "Code", "Code", applicantWorkHistory.CountryCode);
            return(View(applicantWorkHistory));
        }