Example #1
0
        public async Task <IActionResult> Edit(int?id)
        {
            VerificationOfEducationViewModel verificationOfEducationViewModel = new VerificationOfEducationViewModel();

            if (id != null)
            {
                TableVerificationOfEducation verificationOfEducation = await _context.TableVerificationOfEducation
                                                                       .FirstOrDefaultAsync(p => p.VerificationOfEducationId == id);

                VerificationOfEducationViewModel verificationOfEducationView = new VerificationOfEducationViewModel
                {
                    Id = verificationOfEducation.VerificationOfEducationId,
                    VerificationStatus        = verificationOfEducation.VerificationStatus,
                    DateOfVerification        = verificationOfEducation.DateOfVerification,
                    EmployeeRegistrationLogId = verificationOfEducation.EmployeeRegistrationLogId,
                    PositionId      = verificationOfEducation.PositionId,
                    Recommendations = verificationOfEducation.Recommendations
                };
                if (verificationOfEducation != null)
                {
                    return(View(verificationOfEducationView));
                }
            }
            return(NotFound());
        }
Example #2
0
        public async Task <IActionResult> Edit(VerificationOfEducationViewModel model)
        {
            TableVerificationOfEducation tableVerificationOfEducation = _context.TableVerificationOfEducation.Find(model.Id);

            tableVerificationOfEducation.Recommendations    = model.EnumerationRecommendations.ToString();
            tableVerificationOfEducation.VerificationStatus = model.EnumerationStatus.ToString();

            _context.TableVerificationOfEducation.Update(tableVerificationOfEducation);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #3
0
        public async Task <IActionResult> Delete(int?id)
        {
            if (id != null)
            {
                TableVerificationOfEducation verificationOfEducation = await _context.TableVerificationOfEducation.FirstOrDefaultAsync(p => p.VerificationOfEducationId == id);

                if (verificationOfEducation != null)
                {
                    _context.TableVerificationOfEducation.Remove(verificationOfEducation);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            return(NotFound());
        }
Example #4
0
        public async Task <IActionResult> Create(VerificationOfEducationViewModel model)
        {
            if (ModelState.IsValid)
            {
                TableVerificationOfEducation verificationOfEducation = new TableVerificationOfEducation
                {
                    Recommendations               = "",
                    VerificationStatus            = "Не аттестован",
                    DateOfVerification            = DateTime.Now,
                    DateOfCertificationCompletion = model.DateOfCertificationCompletion,
                    EmployeeRegistrationLogId     = model.EmployeeRegistrationLogId,
                    PositionId = model.PositionId,
                };

                _context.TableVerificationOfEducation.Add(verificationOfEducation);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }