/// <summary> /// saves check payment details /// </summary> /// <param name="chkp"> Check Payment Model </param> public void PostCheckPayment(CheckPaymentModel chkp) { using (var _ctx = new ChinmayaEntities()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <CheckPaymentModel, CheckPayment>(); }); IMapper mapper = config.CreateMapper(); var chk = new CheckPayment { AccountHolderName = chkp.AccountHolderName, AccountTypeId = chkp.AccountTypeId, BankName = chkp.BankName, AccountNumber = chkp.AccountNumber, RoutingNumber = chkp.RoutingNumber, Amount = chkp.Amount, StatusId = 1, CreatedBy = chkp.CreatedBy, CreatedDate = DateTime.Now }; _ctx.CheckPayments.Add(chk); try { _ctx.SaveChanges(); } catch { throw; } } }
public async Task <ActionResult> PaymentMethod(CheckPaymentModel data, string prevBtn, string nextBtn) { ViewBag.AccountType = await _common.GetAccountType(); if (prevBtn != null) { return(RedirectToAction("ClassesConfirm", "EventRegistration")); } else { if (nextBtn != null) { if (ModelState.IsValid && data.paymentType == "Check") { var amount = TempData["Amount"]; data.CreatedBy = User.UserId; data.Amount = Convert.ToDecimal(amount); HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/Payment/PostCheckPayment", data, true); return(RedirectToAction("MyAccount", "Account")); } } } return(View()); }
public IHttpActionResult PostCheckPayment(CheckPaymentModel obj) { try { _payment.PostCheckPayment(obj); return(Ok("Success")); } catch { throw; } }
public IHttpActionResult PostCheckPayment(CheckPaymentModel obj) { try { _payment.PostCheckPayment(obj); return(Ok("Success")); } catch (Exception) { return(Ok("Something went wrong")); } }
/// <summary> /// saves check payment details /// </summary> /// <param name="chkp"> Check Payment Model </param> public void PostCheckPayment(CheckPaymentModel chkp) { using (var _ctx = new ChinmayaEntities()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <CheckPaymentModel, CheckPayment>(); }); IMapper mapper = config.CreateMapper(); var chk = new CheckPayment { AccountHolderName = chkp.AccountHolderName, AccountTypeId = chkp.AccountTypeId, BankName = chkp.BankName, AccountNumber = chkp.AccountNumber, RoutingNumber = chkp.RoutingNumber, Amount = chkp.Amount, StatusId = 1, CreatedBy = chkp.CreatedBy, CreatedDate = DateTime.Now }; _ctx.CheckPayments.Add(chk); try { _ctx.SaveChanges(); } catch (DbEntityValidationException e) { foreach (var even in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", even.Entry.Entity.GetType().Name, even.Entry.State); foreach (var ve in even.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } } } }
public async Task <ActionResult> PaymentMethod(CheckPaymentModel data, string prevBtn, string nextBtn) { ViewBag.AccountType = await _common.GetAccountType(); if (prevBtn != null) { List <ClassesConfirmModel> classesConfirm = new List <ClassesConfirmModel>(); classesConfirm = TempData["mydata"] as List <ClassesConfirmModel>; return(View("../EventRegistration/ClassesConfirm", classesConfirm)); } else { if (nextBtn != null) { if (ModelState.IsValid && data.paymentType == "Check") { var amount = TempData["Amount"]; data.CreatedBy = User.UserId; data.Amount = Convert.ToDecimal(amount); HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/Payment/PostCheckPayment", data, true); List <ClassesConfirmModel> classConfirm = new List <ClassesConfirmModel>(); classConfirm = TempData["mydata"] as List <ClassesConfirmModel>; foreach (var item in classConfirm) { EventRegistrationModel registrationModel = new EventRegistrationModel(); registrationModel.OwnerId = User.UserId; registrationModel.FamilyMemberId = item.uFamilyMembers.Id; foreach (var i in item.Events) { registrationModel.EventId = i.Id; HttpResponseMessage userResponseMessage1 = await Utility.GetObject("/api/Payment/EventRegistration", registrationModel, true); } } //return RedirectToAction("MyAccount", "Account"); ViewBag.Message = "Your payment details has been received. The payment will be processed subject to check realization."; return(View()); } } } return(View()); }