コード例 #1
0
        public async Task <IActionResult> Create([Bind("LastName,FirstName,Address,PhoneNumber")] Applicant applicant)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(applicant);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (DbUpdateException)
            {
                ModelState.AddModelError("", "Unable to save changes.");
            }

            if (ModelState.IsValid)             //check for validation and add and save changes
            {
                _context.Add(applicant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(applicant));
        }
コード例 #2
0
        public async Task <string> ChangeLoginAsync(UsrChangeUser logins)
        {
            UsrAdmin user = new UsrAdmin();

            try
            {
                user = await _resumeContext.UsrAdmins.Where(users => users.Login == logins.oldValue).FirstOrDefaultAsync();

                if (user == null)
                {
                    return("Incorrect login");
                }
                user.Login = logins.newValue;
                if (await _resumeContext.SaveChangesAsync() == 1)
                {
                    return(null);
                }
                else
                {
                    return("Fails save DB");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Fail get or set data of DB");
                return("Fail get or set data of DB");
            }
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("StudyType,StudyName,School,ID,StartDate,EndDate,ResumeId")] Academic academic)
        {
            if (id != academic.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(academic);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AcademicExists(academic.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "Resumes", new { id = academic.ResumeId }));
            }
            return(View(academic));
        }
コード例 #4
0
        public async Task <IActionResult> PutResume_Company([FromRoute] int id, [FromBody] Resume_Company Resume_Company)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != Resume_Company.ID)
            {
                return(BadRequest());
            }

            _context.Entry(Resume_Company).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Resume_CompanyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("Id,CompanyName,DepartmentName,Title,DateOfStart,DateOfEnd,Description,IsCurrent")] Experience experience)
        {
            if (ModelState.IsValid)
            {
                _context.Add(experience);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(experience));
        }
        public async Task <IActionResult> Create([Bind("ID,SkillDescrption,Date,InstitutionName,State,City,ZipCode")] ProfessionalSkill professionalSkill)
        {
            if (ModelState.IsValid)
            {
                _context.Add(professionalSkill);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(professionalSkill));
        }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("ID,FirstName,MiddleName,LastName,StreetNumber,Street,City,State,ZipCode,PhoneNumber,EmailAddr,Website")] Contact contact)
        {
            if (ModelState.IsValid)
            {
                _context.Add(contact);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(contact));
        }
コード例 #8
0
        public async Task <IActionResult> Create([Bind("Id,Firstname,Surname,DateOfBirth,Title,Description,Address,Email,PhoneNumber,Location")] Information information)
        {
            if (ModelState.IsValid)
            {
                _context.Add(information);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(information));
        }
コード例 #9
0
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,DateOfBirth,Address,Contact,Email")] Applicant applicant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(applicant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(applicant));
        }
コード例 #10
0
        public async Task <IActionResult> Create([Bind("ID,firstName,lastName,companyName,mailingAddress,city,state,emailAddress,phone, applicantID")] references references)
        {
            if (ModelState.IsValid)
            {
                _context.Add(references);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(references));
        }
コード例 #11
0
        public async Task <IActionResult> Create([Bind("Id,Name,Percent")] Skill skill)
        {
            if (ModelState.IsValid)
            {
                _context.Add(skill);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View());
        }