// 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")); }
// 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.CertificateCategory.Add(CertificateCategory); await _context.SaveChangesAsync(); 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.EmailServerConfiguration.Add(EmailServerConfiguration); await _context.SaveChangesAsync(); 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.CertificateInfo.Add(CertificateInfo); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } CertificateCategory = await _context.CertificateCategory.FindAsync(id); if (CertificateCategory != null) { _context.CertificateCategory.Remove(CertificateCategory); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } EmailServerConfiguration = await _context.EmailServerConfiguration.FindAsync(id); if (EmailServerConfiguration != null) { _context.EmailServerConfiguration.Remove(EmailServerConfiguration); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }