Exemplo n.º 1
0
        public async Task <IActionResult> OnPostRejectAsync(int ID)
        {
            tApplicant applicant = await _context.tApplicant.SingleOrDefaultAsync(a => a.applicant_id == ID);

            _context.Attach(applicant).State = EntityState.Modified;
            applicant.status = "Rejected";
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostRejectAsync(int ID)
        {
            tBatch batch = await _context.tBatch.SingleOrDefaultAsync(b => b.batch_id == ID);

            batchTemp = batch;
            _context.Attach(batch).State = EntityState.Modified;
            batch.approval_status        = "Rejected";
            batch.approved_date          = DateTime.Now.ToString("dd MMM yyyy HH:mm");
            batch.approved_by            = "System";
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(tQuestion).State = EntityState.Modified;
            tQuestion.edit_by         = "System";
            tQuestion.edit_date       = DateTime.Now;
            tQuestion.create_by       = oldQuestion.create_by;
            tQuestion.create_date     = oldQuestion.create_date;
            tQuestion.approval_status = "Approved";
            tQuestion.approved_by     = "System";
            tQuestion.approved_date   = DateTime.Now;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tQuestionExists(tQuestion.question_id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(tUser).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tUserExists(tUser.user_id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> OnPostAsync(int ID)
        {
            tAnswer.create_by   = answer.create_by;
            tAnswer.create_date = answer.create_date;
            tAnswer.edit_by     = "System";
            tAnswer.edit_date   = DateTime.Now;
            tAnswer.question_id = answer.question_id;
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            _context.Attach(tAnswer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tAnswerExists(tAnswer.answer_id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("/Questions"));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(tType).State = EntityState.Modified;

            try
            {
                tType.create_by   = type.create_by;
                tType.create_date = type.create_date;
                tType.edit_by     = "System";
                tType.edit_date   = DateTime.Now;
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tTypeExists(tType.type_name))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.tMenu.Add(tMenu);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> OnPostAsync()
        {
            tProgramQuestion pquestion = new tProgramQuestion();

            if (!ModelState.IsValid)
            {
                return(Page());
            }
            tQuestion.approval_status = "Approved";
            tQuestion.approved_by     = "System";
            tQuestion.approved_date   = DateTime.Now;
            tQuestion.create_by       = "System";
            tQuestion.create_date     = DateTime.Now;
            tQuestion.edit_by         = "System";
            tQuestion.edit_date       = DateTime.Now;
            _context.tQuestion.Add(tQuestion);
            _context.SaveChanges();
            // id after insert question
            int id = tQuestion.question_id;

            pquestion.question_id = id;
            pquestion.program_id  = pq.program_id;
            _context.tProgramQuestion.Add(pquestion);
            await _context.SaveChangesAsync();

            for (int i = 0; i < 5; i++)
            {
                tAnswer a = new tAnswer();
                a.answer_detail = i.ToString();;
                a.create_by     = "System";
                a.create_date   = DateTime.Now;
                a.edit_by       = "System";
                a.edit_date     = DateTime.Now;
                a.question_id   = id;
                a.score         = i;
                _context.tAnswer.Add(a);
                await _context.SaveChangesAsync();
            }
            return(RedirectToPage("./Index"));
        }
Exemplo n.º 9
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            tBatch.approval_status = "Requested";
            _context.tBatch.Add(tBatch);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 10
0
        public async Task <IActionResult> OnPostAsync(int?id, int?app)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            applicantProgram.applicant_id           = ap.applicant_id;
            applicantProgram.program_id             = ap.program_id;
            applicantProgram.batch_id               = ap.batch_id;
            _context.Attach(applicantProgram).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(Redirect("./Details?id=" + id + "&app=" + app));
        }
Exemplo n.º 11
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            tProgram.create_by   = "System";
            tProgram.create_date = DateTime.Now;
            tProgram.edit_by     = "system";
            tProgram.edit_date   = DateTime.Now;
            _context.tProgram.Add(tProgram);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 12
0
        public async Task <IActionResult> OnPostAsync()
        {
            //if (!ModelState.IsValid)
            //{
            //    return Page();
            //}

            tGroup.create_by   = "System";
            tGroup.create_date = DateTime.Now;
            tGroup.edit_by     = "System";
            tGroup.edit_date   = DateTime.Now;
            _context.tGroup.Add(tGroup);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 13
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            tAnswer.question_id = (int)id;
            tAnswer.create_by   = "System";
            tAnswer.create_date = DateTime.Now;
            tAnswer.edit_by     = "System";
            tAnswer.edit_date   = DateTime.Now;
            _context.tAnswer.Add(tAnswer);
            await _context.SaveChangesAsync();

            return(Redirect("/Answers/Create?id=" + id));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            tProvince = await _context.tProvince.FindAsync(id);

            if (tProvince != null)
            {
                _context.tProvince.Remove(tProvince);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 15
0
        public async Task <IActionResult> OnPostAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            tUser = await _context.tUser.FindAsync(id);

            if (tUser != null)
            {
                _context.tUser.Remove(tUser);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 16
0
        public async Task <IActionResult> OnPostAsync()
        {
            //if (!ModelState.IsValid)
            //{
            //    return Page();
            //}
            tApplicant.create_by   = "System";
            tApplicant.create_date = DateTime.Now;
            tApplicant.edit_by     = "System";
            tApplicant.status      = "Approved";
            tApplicant.edit_date   = DateTime.Now;
            tApplicant.last_login  = DateTime.MaxValue;
            _context.tApplicant.Add(tApplicant);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 17
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            tProgram = await _context.tProgram.FindAsync(id);

            if (tProgram != null)
            {
                //_context.tProgram.Remove(tProgram);
                _context.tProgram.Update(tProgram);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }