public async Task <ActionResult> ForgotPassword([Bind("UserName,Password,RoleId")] AccountInformation accountInformation, string confirmPass) { var user = await _context.AccountInformation.FindAsync(accountInformation.UserName); accountInformation.RoleId = user.RoleId; if (accountInformation.Password.Equals(user.Password)) { ModelState.AddModelError("Password", "you can't use old password"); return(View()); } if (!accountInformation.Password.Equals(confirmPass)) { ModelState.AddModelError("Password", "Password mismatch"); return(View()); } if (ModelState.IsValid) { user.Password = accountInformation.Password; _context.Update(user); await _context.SaveChangesAsync(); TempData["Password"] = "******"; return(RedirectToAction("Index", "Home")); } // If we got this far, something failed, redisplay form return(View(accountInformation)); }
public async Task <IActionResult> Edit(Guid id, [Bind("JobApplicationId,JobId,applicantId")] JobApplication jobApplication) { if (id != jobApplication.JobApplicationId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(jobApplication); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobApplicationExists(jobApplication.JobApplicationId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(jobApplication)); }
public async Task <IActionResult> Edit(Guid id, [Bind("JobId,Title,JobFunction,Description,Requirement,Responsibilities,Qualifications,Skills,ModifiedDate,CreatedDate,StartDate,EndDate,IsPublic,IsDraft,OwnerId")] JobPosting jobPosting) { if (id != jobPosting.JobId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(jobPosting); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobPostingExists(jobPosting.JobId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(jobPosting)); }
public async Task <IActionResult> Edit(string id, [Bind("FirstName,LastName,Email,CoverLetter")] Resume resume) { if (id != resume.Email) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(resume); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResumeExists(resume.Email)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(resume)); }
public async Task <IActionResult> Edit(string id, [Bind("Email,CompanyName,isActive,CreatedDate")] Employer employer) { if (id != employer.Email) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployerExists(employer.Email)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(employer)); }
public async Task <IActionResult> Edit(int id, [Bind("JobId,JobTitle,Category,Location,Jobtype,MaxSalary,MinSalary,JobDescription,PayPeriod,NumberOfPosition,JobPostDate,JobExpiryDate,CompnayId")] JobDetails jobDetails) { if (id != jobDetails.JobId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(jobDetails); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobDetailsExists(jobDetails.JobId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompnayId"] = new SelectList(_context.CompanyDetails, "CompanyId", "CompanyId", jobDetails.CompnayId); return(View(jobDetails)); }
public async Task <IActionResult> Edit(int id, [Bind("ExperienceId,StartDate,EndDate,CompanyName,Position,WorkDone")] Experience experience) { if (id != experience.ExperienceId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(experience); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExperienceExists(experience.ExperienceId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(experience)); }
public async Task <IActionResult> Edit(int id, [Bind("EducationId,SchoolName,EducationType,StartDate,EndDate")] Education education) { if (id != education.EducationId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(education); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EducationExists(education.EducationId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(education)); }
public async Task <IActionResult> Edit(int id, [Bind("CompanyId,CompanyName,CompanyAddress,CompanyCity,CompanyPostalCode,CompanyLandLinePhoneNumber,CompanyLandLineExtensionNumber,CompanyEmailId,CompanyRegistrationDateTime,CompanyContactPerson,RoleId,UserName")] CompanyDetails companyDetails) { if (id != companyDetails.CompanyId) { return(NotFound()); } try { if (ModelState.IsValid) { try { _context.Update(companyDetails); TempData["success"] = true; await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyDetailsExists(companyDetails.CompanyId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Details", "CompanyDetail", new { @id = companyDetails.CompanyId })); } ViewData["RoleId"] = new SelectList(_context.Role, "RoleId", "PermissionType", companyDetails.RoleId); ViewData["UserName"] = new SelectList(_context.AccountInformation, "UserName", "UserName", companyDetails.UserName); return(View(companyDetails)); } catch (Exception Ex) { ViewData["ErrorMessage"] = Ex.GetBaseException().Message; return(View("Create", "CompanyDetails")); } }
public async Task <IActionResult> Edit(int id, [Bind("JobId,JobTitle,Category,Location,Jobtype,MaxSalary,MinSalary,JobDescription,PayPeriod,NumberOfPosition,JobPostDate,JobExpiryDate,CompnayId")] JobDetails jobDetails) { if (id != jobDetails.JobId) { return(NotFound()); } try { if (ModelState.IsValid) { try { _context.Update(jobDetails); await _context.SaveChangesAsync(); TempData["success"] = true; } catch (DbUpdateConcurrencyException) { if (!JobDetailsExists(jobDetails.JobId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Details", "JobDetail", new { @id = jobDetails.JobId })); } ViewData["CompanyName"] = new SelectList(_context.CompanyDetails, "CompanyId", "CompanyName"); return(View(jobDetails)); }catch (Exception Ex) { ViewData[""] = Ex.GetBaseException().Message; ViewData["CompanyName"] = new SelectList(_context.CompanyDetails, "CompanyId", "CompanyName"); return(View(jobDetails)); } }
public void Edit(Job job) { _context.Update(job); _context.ChangeTracker.DetectChanges(); }