Esempio n. 1
0
 public ActionResult MakePayment(int id, int type)
 {
     try
     {
         BidModel bid     = BidModel.GetBidById(id).First();
         Payment  payment = new Payment();
         payment.Amount = bid.Amount;
         payment.BidId  = id;
         payment.Type   = type;
         payment.UserId = User.Identity.GetUserId();
         int paymentId = payment.Save();
         if (type == 1)
         {
             //Card payment actions
             return(RedirectToAction("Index", "Home"));
         }
         else
         {
             return(RedirectToAction("PaymentApproved", "Bid", new { id = paymentId }));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
        public ActionResult Index(int id)
        {
            BidModel model = BidModel.GetBidById(id).First();

            if (!model.UserId.Equals(User.Identity.GetUserId()))
            {
                throw new HttpException(404, "Wrong user");
            }

            return(View(model));
        }
Esempio n. 3
0
        public JsonResult SetBidWinner(int id)
        {
            BidModel.SetWinner(id);
            BidModel  bid  = BidModel.GetBidById(id).First();
            MailModel mail = new MailModel();

            mail.Subject = "Դուք հաղթել եք";
            mail.Email   = UserManager.FindById(bid.UserId).Email;
            var callbackUrl = Url.Action("Index", "Bid", new { id = id }, protocol: Request.Url.Scheme);

            mail.Body = string.Format(Resource.EmailConfirmationBid, callbackUrl);
            mail.SendMail();
            return(Json(string.Format("Bid set as winner"), JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        public ActionResult PaymentApproved(int id)
        {
            BidModel bid = BidModel.GetBidById(id).First();

            if (bid.UserId.Equals(User.Identity.GetUserId()))
            {
                ViewBag.BidId = id;
                return(View());
            }
            else
            {
                throw new HttpException(404, "User not found");
            }
        }
Esempio n. 5
0
        public ActionResult MakePaymentCard(int id)
        {
            BidModel model = BidModel.GetBidById(id).First();

            return(View(model));
        }