// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (EmailServerConfiguration.ID == 0) { EmailServerConfiguration.Password = PasswordEncryptionUtil.Encrypt(EmailServerConfiguration.Password); _context.EmailServerConfiguration.Add(EmailServerConfiguration); await _context.SaveChangesAsync(); } else { _context.Attach(EmailServerConfiguration).State = EntityState.Modified; try { EmailServerConfiguration.Password = PasswordEncryptionUtil.Encrypt(EmailServerConfiguration.Password); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmailServerConfigurationExists(EmailServerConfiguration.ID)) { return(NotFound()); } else { throw; } } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } string categorySelected = _context.CertificateCategory.Where(a => a.CertificateCategoryID == Convert.ToInt32(CertificateInfo.CertificateCategoryID)).Select(a => a.CertificateCategoryID).FirstOrDefault().ToString(); CertificateInfo.CertificateCategoryID = Convert.ToInt32(categorySelected); _context.Attach(CertificateInfo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CertificateInfoExists(CertificateInfo.CertificateID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(CertificateCategory).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CertificateCategoryExists(CertificateCategory.CertificateCategoryID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }