Beispiel #1
0
        public async Task EditLawyerSpcecialization(LawyerSpecialization editLawyerSpecialization)
        {
            var editLawyerSpec = await _context.LawyerSpecializations.FindAsync(editLawyerSpecialization.LawyerSpecializationId);

            editLawyerSpec.SpecializationId = editLawyerSpecialization.SpecializationId;
            editLawyerSpec.EndYear          = editLawyerSpecialization.EndYear;
            _context.Update(editLawyerSpec);
            await _context.SaveChangesAsync();
        }
        public async Task <IActionResult> AddOrEditLawyerSpecialization(LawyerSpecialization lawyerSpecialization)
        {
            if (ModelState.IsValid)
            {
                if (lawyerSpecialization.LawyerSpecializationId != 0)
                {
                    await _lawyerService.EditLawyerSpcecialization(lawyerSpecialization);

                    return(RedirectToAction("EditLawyer", "Lawyer", new { @id = lawyerSpecialization.LawyerId }));
                }
                else
                {
                    await _lawyerService.AddLawyerSpcecialization(lawyerSpecialization);

                    return(RedirectToAction("EditLawyer", "Lawyer", new { @id = lawyerSpecialization.LawyerId }));
                }
            }
            return(View());
        }
Beispiel #3
0
        public async Task AddLawyerSpcecialization(LawyerSpecialization addLawyerSpecialization)
        {
            await _context.LawyerSpecializations.AddAsync(addLawyerSpecialization);

            await _context.SaveChangesAsync();
        }