Example #1
0
        public async Task <IActionResult> Edit(long id, [Bind("AssessorId,PersonId,AccredStartDate,AccredEndDate,AccreditationStatusId,RegistrationNo,EvaluatorsId,ApplicationDate,RegistrationDate,ApprovedBy,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated,ProcessIndicatorsId,ApplicationTypesId,SendForApprovalDate,CertificateIssuedYn,CertificateDate,CertificateNo,ReissueDate,EtqeId")] Assessor assessor)
        {
            if (id != assessor.AssessorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                var user = await _lookUpService.GetCurrentLoggedInUser(User.Identity.Name);

                assessor.LastUpdatedBy = user.UserName;
                assessor.DateUpdated   = DateTime.Now;

                try
                {
                    _context.Update(assessor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AssessorExists(assessor.AssessorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccreditationStatusId"] = new SelectList(_context.AccreditationStatuses, "AccreditationStatusId", "AccreditationStatusId", assessor.AccreditationStatusesId);
            ViewData["EtqeId"] = new SelectList(_context.Etqe, "EtqeId", "EtqeId", assessor.EtqeId);
            return(View(assessor));
        }
        public async Task <IActionResult> Edit(long id, [Bind("LearnerId,PersonId,SchoolId,SchoolGradeId,MotivationText,YearSchoolCompleted,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] Learner learner)
        {
            if (id != learner.LearnerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                learner.LastUpdatedBy = "admin";
                learner.DateUpdated   = DateTime.Now;

                try
                {
                    _context.Update(learner);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LearnerExists(learner.LearnerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            ViewData["PersonId"]      = new SelectList(_context.Person, "PersonId", "PersonId", learner.PersonId);
            ViewData["SchoolId"]      = new SelectList(_context.School, "SchoolId", "SchoolId", learner.SchoolId);
            ViewData["SchoolGradeId"] = new SelectList(_context.SchoolGrade, "SchoolGradeId", "SchoolGradeId", learner.SchoolGradeId);
            return(PartialView(learner));
        }