public async Task <IActionResult> Edit(int id, [Bind("AppointmentPaymentId,TransactionNumber,AppointmentId,Total,CreatedDateTime,LastModifiedDateTime")] AppointmentPayment appointmentPayment) { if (id != appointmentPayment.AppointmentPaymentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(appointmentPayment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppointmentPaymentExists(appointmentPayment.AppointmentPaymentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AppointmentId"] = new SelectList(_context.Appointments, "AppointmentId", "Notes", appointmentPayment.AppointmentId); return(View(appointmentPayment)); }
public void VerifyAppointmentPaymentIdAppointmentPayment() { var appointmentPayment = new AppointmentPayment(); int result = 13; appointmentPayment.IdAppointmentPayment = 13; Assert.Equal(appointmentPayment.IdAppointmentPayment, result); }
//public async Task<IActionResult> Create([Bind("AppointmentPaymentId,TransactionNumber,AppointmentId,Total,CreatedDateTime,LastModifiedDateTime")] AppointmentPayment appointmentPayment) //{ // if (ModelState.IsValid) // { // _context.Add(appointmentPayment); // await _context.SaveChangesAsync(); // return RedirectToAction(nameof(Index)); // } // ViewData["AppointmentId"] = new SelectList(_context.Appointments, "AppointmentId", "Notes", appointmentPayment.AppointmentId); // return View(appointmentPayment); //} public async Task <IActionResult> Create([Bind("AppointmentPaymentId,TransactionNumber,AppointmentId,Total,CreatedDateTime,LastModifiedDateTime")] AppointmentPayment appointmentPayment) { Random rnd = new Random(); appointmentPayment.TransactionNumber = rnd.Next(1, 100); if (ModelState.IsValid) { _context.Add(appointmentPayment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AppointmentId"] = new SelectList(_context.Appointments, "AppointmentId", "Notes", appointmentPayment.AppointmentId); return(View(appointmentPayment)); }
public void SaveAppointmentPayment(AppointmentPayment appointmentPayment) { if (appointmentPayment.IdAppointmentPayment == 0) { context.AppointmentPayment.Add(appointmentPayment); } else { AppointmentPayment dbEntry = context.AppointmentPayment. FirstOrDefault(a => a.IdAppointmentPayment == appointmentPayment.IdAppointmentPayment); if (dbEntry != null) { dbEntry.IdAppointment = appointmentPayment.IdAppointment; dbEntry.CtHoursContracted = appointmentPayment.CtHoursContracted; dbEntry.ClHoursWorked = appointmentPayment.ClHoursWorked; dbEntry.PaidByCustomer = appointmentPayment.PaidByCustomer; dbEntry.PaidToCleaner = appointmentPayment.PaidToCleaner; dbEntry.AmountPaidByCustomer = appointmentPayment.AmountPaidByCustomer; dbEntry.AmountPaidToCleaner = appointmentPayment.AmountPaidToCleaner; } } context.SaveChanges(); }
public void VerifyAppointmentPaymentIdAppointmentType() { var appointmentPayment = new AppointmentPayment(); Assert.IsType <int>(appointmentPayment.IdAppointment); }