Example #1
0
        public ActionResult CardUser(CardModel cardModel)
        {
            cardModel.Balance = Session["Balance"].ToString();
            var cardType = _card.GetCardType();

            foreach (var item in cardType.Where(kvp => kvp.Value.ToUpper() == "VIRTUAL CARD" || kvp.Value.ToUpper() == "PREPAID CARD").ToList())
            {
                cardType.Remove(item.Key);
            }
            cardModel.CardTypeList = ApplicationUtilities.SetDDLValue(cardType as Dictionary <string, string>, cardModel.CardType, "--Card Type--");

            if (cardModel.Type == "re")
            {
                ModelState.Remove("MobileNo");
            }

            if (string.IsNullOrEmpty(cardModel.CardNo))
            {
                ModelState.AddModelError("CardNo", "Card Number Required!");
                return(View("CardUser", cardModel));
            }

            else
            {
                IWalletUserBusiness _walletUserBusiness = new WalletUserBusiness();
                var userinfo = _walletUserBusiness.UserInfo(cardModel.MobileNo);
                if (string.IsNullOrEmpty(userinfo.UserId))
                {
                    ModelState.AddModelError("MobileNo", "Invalid Mobile Number");
                    return(View("CardUser", cardModel));
                }
            }

            cardModel.ActionUser = Session["UserId"].ToString();
            CardCommon cardCommon = cardModel.MapObject <CardCommon>();
            //CommonDbResponse dbResponse = _card.CardApproval(cardCommon);
            CommonDbResponse dbResponse = _card.CardUser(cardCommon);

            dbResponse.SetMessageInTempData(this, "Index");
            return(RedirectToAction("Index"));
        }