public ActionResult Index() { string userid = Session["UserId"].ToString(); var cardCommonList = _card.GetCardList(userid).MapObjects <CardModel>(); List <CardModel> cardModels = new List <CardModel>(); var cardType = _card.GetCardType(); foreach (var item in cardCommonList) { CardModel model = new CardModel(); model.FullName = item.FullName; model.UserId = item.UserId; model.Amount = item.Amount; model.CardId = item.CardId; model.CardNo = item.CardNo; model.CardType = item.CardType; model.CardTypeName = cardType.FirstOrDefault(x => x.Key == item.CardType).Value;; model.ExpiryDate = item.ExpiryDate; model.Status = item.Status.Trim();//== "Y" ? "checked" : ""; model.IsReceived = item.IsReceived.Trim(); model.ReceivedFrom = item.ReceivedFrom; cardModels.Add(model); } Dictionary <string, string> cardoptions = new Dictionary <string, string>() { { "0", "--Select Card Options--" }, { "1", "Add New Card" }, { "2", "Card Balance Add/Retrieve" }, { "3", "Card Transfer/Retrieve" } }; ViewBag.CardOptions = ApplicationUtilities.SetDDLValue(cardoptions, "", ""); return(View(cardModels)); }
// GET: Admin/Card public ActionResult Index(string UserId = "", string AgentId = "") { var userID = UserId.DecryptParameter(); if (string.IsNullOrEmpty(UserId)) { return(RedirectToAction("", "Home", new { area = "Admin" })); } var cardCommonList = _card.GetCardList(userID); var UserInfo = _walletUserBusiness.UserInfo(userID); ViewBag.UserName = UserInfo.UserName; ViewBag.FullName = UserInfo.FullName; Session["CardForUser"] = UserInfo.UserName; //Actions foreach (var item in cardCommonList) { item.Action = StaticData.GetActions("UserCard", item.UserId.EncryptParameter(), this, "", "", item.CardNo.EncryptParameter(), item.Status, item.AgentId.EncryptParameter(), item.CardType); #region Status if (item.Status.ToUpper().Equals("YES") || item.Status.ToUpper().Equals("Y")) { item.Status = "<span class='badge badge-success'>Enabled</span>"; } if (item.Status.ToUpper().Equals("NO") || item.Status.ToUpper().Equals("N")) { item.Status = "<span class='badge badge-danger'>Disabled</span>"; } #endregion #region CardType if (item.CardType.Equals("1")) { item.CardType = "<span class='badge badge-success'>Virtual</span>"; } else if (item.CardType.Equals("2")) { item.CardType = "<span class='badge badge-success'>Gift</span>"; } else if (item.CardType.Equals("3")) { item.CardType = "<span class='badge badge-success'>Discount</span>"; } else if (item.CardType.Equals("4")) { item.CardType = "<span class='badge badge-success'>Prepaid</span>"; } else { item.CardType = "<span class='badge badge-success'>Others</span>"; } #endregion } //Column Creator IDictionary <string, string> param = new Dictionary <string, string>(); param.Add("FullName", "Name"); param.Add("MobileNo", "Mobile Number"); param.Add("Email", "Email"); param.Add("CardType", "Card type"); param.Add("CardNo", "Card No."); param.Add("IssueDate", "Issue Date"); param.Add("ExpiryDate", "Expiry Date"); param.Add("Status", "Status"); param.Add("Action", "Action"); ProjectGrid.column = param; //Ends //Add New var grid = ProjectGrid.MakeGrid(cardCommonList, "", "", 0, true, "", "", "Home", "Card", "/Admin/Card", "/Admin/Card/AddCard?UserId=" + UserId + "&AgentId=" + AgentId); ViewData["grid"] = grid; if (cardCommonList.Count() == 0) { ViewBag.EmptyMessage = "True"; } return(View()); }