public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(RedirectToPage("/Scripts/ScriptVoiceEdit", new { id = Scripts.MessageTypeId })); //return Page(); } _context.Attach(Scripts).State = EntityState.Modified; foreach (var item in Scripts.ScriptSchedules) { _context.Attach(item).State = EntityState.Modified; } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScriptsExists(Scripts.ScriptId)) { return(NotFound()); } else { throw; } } int Customerid = HttpContext.Session.GetInt32("CustomerID").Value; return(RedirectToPage("/MessageTypes/MessageTypeIndex", new { customerid = Customerid })); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(MessageTypes).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MessageTypesExists(MessageTypes.MessageTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }