public async Task <IActionResult> PutStudentSetUp(int?id, StudentSetUp studentSetUp)
        {
            if (id == null)
            {
                return(BadRequest("StudentId is Empty"));
            }

            try
            {
                var newEmployerAttached = await _context.StudentSetUps.FirstOrDefaultAsync(m => m.Id == id);

                if (newEmployerAttached == null)
                {
                    return(NotFound($"Student Not Found For The Selected Id {id}"));
                }
                //bool nowSuspend = suspendStudent.Suspended = true;
                newEmployerAttached.EmployerSuperSetupId = studentSetUp.EmployerSuperSetupId;

                await _context.SaveChangesAsync();

                return(Ok(newEmployerAttached));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
        public async Task <ActionResult <StudentSetUp> > PostStudentSetUp(StudentSetUp studentSetUp)
        {
            _context.StudentSetUps.Add(studentSetUp);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetStudentSetUp", new { id = studentSetUp.Id }, studentSetUp));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> PutStudentSetUp(int?id, StudentSetUp studentSetUp)
        {
            if (id == null)
            {
                return(BadRequest("StudentId is Empty"));
            }

            try
            {
                var studentSuspended = await _context.StudentSetUps.FirstOrDefaultAsync(m => m.Id == id);

                if (studentSuspended == null)
                {
                    return(NotFound($"Student Not Found For The Selected Id {id}"));
                }
                //bool nowSuspend = suspendStudent.Suspended = true;
                studentSuspended.BankSetUpId = studentSetUp.BankSetUpId;
                studentSuspended.AccountName = studentSetUp.AccountName;
                studentSuspended.AccountNo   = studentSetUp.AccountNo;
                studentSuspended.SwitchCode  = studentSetUp.SwitchCode;

                await _context.SaveChangesAsync();

                return(Ok(studentSuspended));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
        public async Task <IActionResult> PutStudentSetUp(int?id, StudentSetUp studentSetUp)
        {
            if (id == null)
            {
                return(BadRequest("StudentId is Empty"));
            }

            try
            {
                var InstitutionOfficer = await _context.StudentSetUps.FirstOrDefaultAsync(m => m.Id == id);

                if (InstitutionOfficer == null)
                {
                    return(NotFound($"Student Not Found For The Selected Id {id}"));
                }
                //bool nowSuspend = suspendStudent.Suspended = true;
                InstitutionOfficer.InstitutionOfficerId    = studentSetUp.InstitutionOfficerId;
                InstitutionOfficer.OldInstitutionOfficerId = InstitutionOfficer.InstitutionOfficerId;
                InstitutionOfficer.DateChanged             = DateTime.Now;

                await _context.SaveChangesAsync();

                return(Ok(InstitutionOfficer));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> OnPostUpdateStudentRecordsAsync(int Id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var newStudentCreated = new StudentSetUp
            {
                MatricNumber = CreateStudentsViewModels.MatricNumber,
                Surname      = CreateStudentsViewModels.Surname,
                OtherNames   = CreateStudentsViewModels.OtherNames,
                MatricYear   = CreateStudentsViewModels.MatricYear,
                CoursesId    = CreateStudentsViewModels.CourseId,
                YearOfStudy  = CreateStudentsViewModels.LevelStudy,
                //NationalityId = CreateStudentsViewModels.NationalityId,
                //NationalityId = CreateStudentsViewModels.NationalityId,
                //StateId = CreateStudentsViewModels.StateId,
                PhoneNo = CreateStudentsViewModels.PhoneNumber,
                Email   = CreateStudentsViewModels.Email,
                //InstitutionOfficerId = CreateStudentsViewModels.InstitutionOfficerId,
                StudentType = CreateStudentsViewModels.StudentType,
                SiwesYear   = CreateStudentsViewModels.SiwesYear,
                BatchNo     = CreateStudentsViewModels.BatchNo
            };

            _context.StudentSetUps.Add(newStudentCreated);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./StudentList?id=" + Id));
        }
Ejemplo n.º 6
0
        //public ActionResult OnPostDownloadFile()
        //{
        //    return File("/downloads/Form8.pdf", "application/octet-stream",
        //                "Form8.pdf");
        //}
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(BadRequest("INSTITUTION NOT FOUND"));
            }
            //Institution = await _context.Institution.Where(x => x.Id == id).SingleOrDefaultAsync();
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var newStudentCreated = new StudentSetUp
            {
                MatricNumber  = CreateStudentsViewModels.MatricNumber,
                Surname       = CreateStudentsViewModels.Surname,
                OtherNames    = CreateStudentsViewModels.OtherNames,
                MatricYear    = CreateStudentsViewModels.MatricYear,
                CoursesId     = CreateStudentsViewModels.CourseId,
                YearOfStudy   = CreateStudentsViewModels.LevelStudy,
                LGAId         = CreateStudentsViewModels.LGAId,
                PhoneNo       = CreateStudentsViewModels.PhoneNumber,
                Email         = CreateStudentsViewModels.Email,
                InstitutionId = id,
                StudentType   = CreateStudentsViewModels.StudentType,
                SiwesYear     = CreateStudentsViewModels.SiwesYear,
                BatchNo       = CreateStudentsViewModels.BatchNo
            };

            _context.StudentSetUps.Add(newStudentCreated);
            await _context.SaveChangesAsync();

            return(Redirect("./StudentList?id=" + id));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> PutStudentSetUp(int?id, StudentSetUp studentSetUp)
        {
            if (id == null)
            {
                return(BadRequest("No Student Found Selected"));
            }

            try
            {
                var updateStudentRecords = await _context.StudentSetUps.FirstOrDefaultAsync(m => m.Id == id);

                if (updateStudentRecords == null)
                {
                    return(NotFound($"Student Not Found For The Selected Id {id}"));
                }
                updateStudentRecords.Surname      = studentSetUp.Surname;
                updateStudentRecords.OtherNames   = studentSetUp.OtherNames;
                updateStudentRecords.MatricNumber = studentSetUp.MatricNumber;
                updateStudentRecords.MatricYear   = studentSetUp.MatricYear;

                updateStudentRecords.CoursesId   = studentSetUp.CoursesId;
                updateStudentRecords.YearOfStudy = studentSetUp.YearOfStudy;
                updateStudentRecords.PhoneNo     = studentSetUp.PhoneNo;
                updateStudentRecords.Email       = studentSetUp.Email;

                updateStudentRecords.BatchNo     = studentSetUp.BatchNo;
                updateStudentRecords.StudentType = studentSetUp.StudentType;
                updateStudentRecords.SiwesYear   = studentSetUp.SiwesYear;
                //updateStudentRecords.InstitutionOfficerId = studentSetUp.InstitutionOfficerId;

                updateStudentRecords.LGAId = studentSetUp.LGAId;
                //updateStudentRecords.S = studentSetUp.SiwesYear;
                //updateStudentRecords.InstitutionOfficerId = studentSetUp.InstitutionOfficerId;
                await _context.SaveChangesAsync();

                return(Ok(updateStudentRecords));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }