Exemplo n.º 1
0
        public ActionResult Choose(String loanId, String offerid, int id)
        {
            SubmitOffer offerData = new OfferService().ConfirmOffer(loanId, offerid);

            using (db = new ChargeAfterEntities())
            {
                //int ids = Convert.ToInt32(Session["id"]);
                var  req   = (from r in db.Requests where r.UserID == id select r).FirstOrDefault();
                long reqID = req.ReqID;

                Request model = db.Requests.Find(reqID);
                model.RequestStatus   = "Authorized";
                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();


                //Stroing Request Responce
                SubmitOfferResponce sOR = new SubmitOfferResponce();
                sOR.userId        = id;
                sOR.loanId        = offerData.loanId;
                sOR.applicationId = offerData.loanId;
                //sOR.type = offerData.type;
                sOR.message = offerData.message;
                //sOR.reason = offerData.reason;

                db.SubmitOfferResponces.Add(sOR);
                db.SaveChanges();


                TempData["ConfirmOffer"] = loanId;
            }

            return(RedirectToAction("Approved"));
        }
Exemplo n.º 2
0
        public ActionResult OfferFortiva(int id)
        {
            using (db = new ChargeAfterEntities())
            {
                try
                {
                    var     offer          = new RequestOffer();
                    var     item           = (List <Item>)Session["cart"];
                    float   subTot         = 0;
                    float   pay            = 0;
                    decimal approvedAmount = 0;
                    if (item != null)
                    {
                        foreach (Item itemPro in (List <Item>)Session["cart"])
                        {
                            float price = Convert.ToSingle(@itemPro.Pro.Price) * 1;
                            subTot = subTot + price;
                            Session["Subtotal"] = subTot;
                        }

                        pay            = Convert.ToSingle(100 + subTot);
                        approvedAmount = Math.Round((decimal)pay, 0);
                    }
                    decimal monthly    = approvedAmount / 6;
                    decimal monthlyPay = Math.Round((decimal)monthly, 0);
                    int?    intIdt     = db.Users.Max(u => (int?)u.Id);
                    offer.UserID = intIdt;

                    offer.TotalPayback    = 6;
                    offer.IncreasePercent = 0;
                    offer.ApprovedAmmount = approvedAmount;
                    offer.MonthlyAmount   = monthlyPay;
                    offer.Lender          = "Fortiva";
                    offer.MonthCount      = 6;

                    db.RequestOffers.Add(offer);
                    var     req   = (from r in db.Requests where r.UserID == intIdt select r).FirstOrDefault();
                    long    reqID = req.ReqID;
                    Request model = db.Requests.Find(reqID);
                    model.RequestStatus   = "Authorized";
                    db.Entry(model).State = EntityState.Modified;
                    db.SaveChanges();
                    TempData["PayBack"] = "6";
                    Session["PayBack"]  = "6";
                    return(RedirectToAction("ReviewSubmit"));
                }
                catch (Exception ex)
                {
                    TempData["message"] = "We can not proceed your request right now !!! Fill all the fields carefully and try again";
                    return(RedirectToAction("Payment"));
                }
            }
        }
Exemplo n.º 3
0
        public ActionResult OfferFortiva(int id)
        {
            using (db = new ChargeAfterEntities())
            {
                var     offer          = new RequestOffer();
                var     item           = (List <Item>)Session["cart"];
                float   subTot         = 0;
                float   pay            = 0;
                decimal approvedAmount = 0;
                if (item != null)
                {
                    foreach (Item itemPro in (List <Item>)Session["cart"])
                    {
                        float price = Convert.ToSingle(@itemPro.Pro.Price) * 1;
                        subTot = subTot + price;
                        Session["Subtotal"] = subTot;
                    }

                    pay            = Convert.ToSingle(100 + subTot);
                    approvedAmount = Math.Round((decimal)pay, 0);
                }
                decimal monthly    = approvedAmount / 6;
                decimal monthlyPay = Math.Round((decimal)monthly, 0);
                // var Oid = user
                offer.UserID = id;

                offer.TotalPayback    = 6;
                offer.IncreasePercent = 0;
                offer.ApprovedAmmount = approvedAmount;
                offer.MonthlyAmount   = monthlyPay;
                offer.Lender          = "Fortiva";
                db.RequestOffers.Add(offer);
                var     req   = (from r in db.Requests where r.UserID == id select r).FirstOrDefault();
                long    reqID = req.ReqID;
                Request model = db.Requests.Find(reqID);
                model.RequestStatus   = "Authorized";
                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();
            }
            TempData["PayBack"] = "6";
            Session["PayBack"]  = "6";
            return(RedirectToAction("Approved"));
        }
Exemplo n.º 4
0
 public ActionResult Refund(FormCollection form)
 {
     try
     {
         var id  = form["rid"];
         int uid = Convert.ToInt32(id);
         using (db = new ChargeAfterEntities())
         {
             var     reqeust = (from r in db.Requests where r.UserID == uid select r).FirstOrDefault();
             long    rid     = reqeust.ReqID;
             Request model   = db.Requests.Find(rid);
             model.RequestStatus   = "Refunded";
             db.Entry(model).State = EntityState.Modified;
             db.SaveChanges();
             TempData["message"] = "You successfully Refunded this amount.";
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         TempData["error"] = "Sorry we can not process the request !!";
         return(RedirectToAction("Index"));
     }
 }