/// <summary> /// 添加用户银行卡信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public ResultModel Insert(UserBankModel model) { var result = new ResultModel() { Data = base._database.Db.YH_UserBankAccount.Insert(model) }; return(result); }
/// <summary> /// Efetua a conversão de um tipo UserBankModel para um tipo UserBank (DTO) /// </summary> /// <returns>UserBank com os dados da model</returns> public static UserBanks UserBankModelToDTO(UserBankModel bankModel) { UserBanks dao = new UserBanks { Account = bankModel.Account, Agency = bankModel.Agency, BankID = bankModel.BankID, ID = bankModel.ID }; return(dao); }
public static UserBankModel UserBankToModel(UserBanks dto) { UserBankModel model = new UserBankModel { Account = dto.Account, Agency = dto.Agency, BankID = dto.BankID, ID = dto.ID }; return(model); }
public ActionResult Paynow(FormCollection form) { int roomId = Convert.ToInt32(Session["roomId"].ToString()); Double roomPrice = Convert.ToDouble(Session["roomPrice"].ToString()); DateTime fromDate = Convert.ToDateTime(Session["fromDate"].ToString()); DateTime toDate = Convert.ToDateTime(Session["toDate"].ToString()); UserBankModel userBank = new UserBankModel(); DateTime currentTime = DateTime.UtcNow; int userID = Convert.ToInt32(Session["userId"].ToString()); //string query = "SELECT * FROM USERBANK WHERE FK_UID=@uid"; //IEnumerable<USERBANK> results = userBank.Database.SqlQuery<USERBANK>(query, new SqlParameter("@uid",userID)); double userAmount = 1000; //foreach (USERBANK userAcnt in results ){ // userAmount = Convert.ToDouble(userAcnt.amount); //} if (userAmount >= roomPrice) { BookingModel bookingModel = new BookingModel(); BOOKING bookingDetails = new BOOKING(); bookingDetails.FK_RID = roomId; bookingDetails.FK_UID = userID; bookingDetails.fromDate = fromDate; bookingDetails.toDate = toDate; bookingDetails.bookedTime = currentTime; bookingModel.BOOKINGs.Add(bookingDetails); bookingModel.SaveChanges(); ViewBag.PaymentStatus = "Success"; ViewBag.PaymentInfo = "Thank you for using our services. Enjoy your stay."; ViewBag.userName = Session["userName"].ToString(); Session.Remove("toDate"); Session.Remove("fromDate"); Session.Remove("adults"); Session.Remove("children"); Session.Remove("roomId"); Session.Remove("roomPrice"); } else { ViewBag.PaymentStatus = "Failure"; ViewBag.PaymentInfo = "Insufficient Funds in your Account. PLease try later."; ViewBag.userName = Session["userName"].ToString(); } ViewBag.userName = Session["userName"].ToString(); return(View()); }
/// <summary> /// 添加用户银行卡信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public string Insert(UserBankModel model, UserBankModel model2) { string status = "0"; using (var tx = _database.Db.BeginTransaction()) { try { tx.YH_UserBankAccount.Insert(model); tx.YH_UserBankAccount.Update(model2); status = "1"; tx.Commit(); } catch (Exception ex) { status = "0"; tx.Rollback(); } } return(status); }