// 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(Address).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AddressExists(Address.AddressID)) { 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()); } DocSchedule.UpdatedAt = DateTime.Now; DocSchedule.DocScheduleYear = (int?)DocSchedule.StartAppointmentAt.Value.Year; DocSchedule.WeekNumber = GetNumberOfWeek(DocSchedule.StartAppointmentAt.Value); DocSchedule.DayOfWeek = (byte?)DocSchedule.StartAppointmentAt.Value.DayOfWeek; _context.Attach(DocSchedule).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DocScheduleExists(DocSchedule.DocScheduleID)) { 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.Patients.Add(Patient); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } DocSchedule = await _context.DocSchedules.FindAsync(id); if (DocSchedule != null) { _context.DocSchedules.Remove(DocSchedule); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task<IActionResult> OnPostAsync(int? id) { if (id == null) { return NotFound(); } Address = await _context.Addresses.FindAsync(id); if (Address != null) { _context.Addresses.Remove(Address); await _context.SaveChangesAsync(); } return RedirectToPage("./Index"); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Patient = await _context.Patients.FindAsync(id); if (Patient != null) { _context.Patients.Remove(Patient); 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()); } if (DocSchedule.StartAppointmentAt != null) { DocSchedule.CreatedAt = DateTime.Now; DocSchedule.UpdatedAt = DateTime.Now; DocSchedule.DocScheduleYear = (int?)DocSchedule.StartAppointmentAt.Value.Year; DocSchedule.WeekNumber = GetNumberOfWeek(DocSchedule.StartAppointmentAt.Value); DocSchedule.DayOfWeek = (byte?)DocSchedule.StartAppointmentAt.Value.DayOfWeek; DocSchedule.PatientID = null; } _context.DocSchedules.Add(DocSchedule); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }