public ActionResult ProcessPayment(PaymentModel model) { if(model.Payment.ClassId!=null) { var enroll = new Enrolled { ClassId = (int)model.Payment.ClassId, StudentId = model.Payment.StudentId }; _enrolledService.Insert(enroll); } model.Location = null; _paymentService.Insert(model.Payment); var userFName = _userService.GetById(model.Payment.StudentId).FirstName; var teacher = _teacherUserService.GetById(model.Payment.TeacherId); //_emailService.SendRequestEmail(teacher.User, userFName); return RedirectToAction("Index", "Search"); }
public ActionResult ProcessPayment(int classId) { var temp = SessionDataHelper.UserId; var user = _userService.GetById(temp); var newClass = _classService.GetById(classId); var locId = user.LocationId; var payment = new PaymentModel{ Payment = new Payment(){ StudentId = user.Id, ClassId = newClass.Id, TeacherId = newClass.TeacherId, Date = DateTime.Now, Amount = (int) newClass.Teacher.ClassRate }, Message = "", }; payment.Location = _locationService.GetById((int)locId); return View(payment); }
public ActionResult ProcessTutorPayment(int studentId, int tutorId) { var user = _userService.GetById(studentId); var teacher = _teacherUserService.GetById(tutorId); var locId = user.LocationId; var payment = new PaymentModel { Payment = new Payment() { StudentId = user.Id, ClassId = null, TeacherId = tutorId, Date = DateTime.Now, Amount = (int)teacher.HourlyRate, }, Message = "per hour" }; payment.Location = _locationService.GetById((int)locId); return View("ProcessPayment",payment); }