Example #1
0
        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));
        }
Example #2
0
        public void VerifyAppointmentPaymentIdAppointmentPayment()
        {
            var appointmentPayment = new AppointmentPayment();

            int result = 13;

            appointmentPayment.IdAppointmentPayment = 13;


            Assert.Equal(appointmentPayment.IdAppointmentPayment, result);
        }
Example #3
0
        //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));
        }
Example #4
0
 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();
 }
Example #5
0
        public void VerifyAppointmentPaymentIdAppointmentType()
        {
            var appointmentPayment = new AppointmentPayment();

            Assert.IsType <int>(appointmentPayment.IdAppointment);
        }