public async Task EditLawyerQualification(LawyerQualification editLawyerQualification) { var editLawyerQuali = await _context.LawyerQualifications.FindAsync(editLawyerQualification.LawyerQualificationId); editLawyerQuali.DegreeId = editLawyerQualification.DegreeId; //editLawyerQuali.InstituteName = editLawyerQualification.InstituteName; // editLawyerQuali.Location = editLawyerQualification.Location; editLawyerQuali.CompletionYear = editLawyerQualification.CompletionYear; _context.LawyerQualifications.Update(editLawyerQuali); await _context.SaveChangesAsync(); }
public async Task <IActionResult> AddOrEditLawyerQualification(LawyerQualification lawyerQualification) { if (ModelState.IsValid) { if (lawyerQualification.LawyerQualificationId != 0) { await _lawyerService.EditLawyerQualification(lawyerQualification); return(RedirectToAction("EditLawyer", "Lawyer", new { @id = lawyerQualification.LawyerId })); } else { await _lawyerService.AddLawyerQualification(lawyerQualification); return(RedirectToAction("EditLawyer", "Lawyer", new { @id = lawyerQualification.LawyerId })); } } return(View()); }
public async Task AddLawyerQualification(LawyerQualification addLawyerQualification) { await _context.LawyerQualifications.AddAsync(addLawyerQualification); await _context.SaveChangesAsync(); }