public async Task <IActionResult> Edit(int id, [Bind("ID,Staff_MstID,Customer_MstID,AppointmentDate,Charges")] Appointment_Mst appointment_Mst) { if (id != appointment_Mst.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(appointment_Mst); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Appointment_MstExists(appointment_Mst.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Customer_MstID"] = new SelectList(_context.Customer_Msts, "ID", "Name", appointment_Mst.Customer_MstID); ViewData["Staff_MstID"] = new SelectList(_context.Staff_Msts, "ID", "Name", appointment_Mst.Staff_MstID); return(View(appointment_Mst)); }
public async Task <IActionResult> Create([Bind("ID,Staff_MstID,Customer_MstID,AppointmentDate,Charges")] Appointment_Mst appointment_Mst) { if (ModelState.IsValid) { _context.Add(appointment_Mst); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Customer_MstID"] = new SelectList(_context.Customer_Msts, "ID", "Name", appointment_Mst.Customer_MstID); ViewData["Staff_MstID"] = new SelectList(_context.Staff_Msts, "ID", "Name", appointment_Mst.Staff_MstID); return(View(appointment_Mst)); }