public void DeleteAgentCard(int CardId)
        {
            Htl_AgentCards comm         = entities.Htl_AgentCards.Where(u => u.CardId == CardId).FirstOrDefault();
            Htl_AgentCards datatodelete = entities.Htl_AgentCards.FirstOrDefault(m => m.AgentCardsId == comm.AgentCardsId);

            entities.DeleteObject(datatodelete);
            entities.SaveChanges();
        }
        public CardViewModel GetAgentInfoByCardId(int CardId)
        {
            Htl_AgentCards AgentCard = entities.Htl_AgentCards.Where(cc => cc.CardId == CardId).SingleOrDefault();
            CardViewModel  model     = new CardViewModel();

            model.Agentviewmodel.First().AgentId = AgentCard.AgentId;

            return(model);
        }
        public void CreateIssueCard(AgentCardViewModel model)
        {
            Htl_AgentCards obj = new Htl_AgentCards
            {
                AgentId    = model.AgentId,
                CardId     = model.HFCardId,
                IssueDate  = DateTime.Now,
                CreateDate = DateTime.Now,
                CreatedBy  = model.CreatedBy,
            };

            entities.AddToHtl_AgentCards(obj);
            entities.SaveChanges();
        }
        //GET: /IssueCard/Details/5

        public ActionResult Details(int id)
        {
            var model = _cardrepo.GetCardDetailsInfo(id);

            TempData["Card Rule"] = _cardrepo.GetCardRule(model.CardTypeId);
            if (model.CardStatusId == 2)
            {
                model.CardRule = _cardrepo.GetCardRule(model.CardTypeId);
                Htl_AgentCards Agent = _issuecardrepo.GetAgentInfoByCardId(id);
                TempData["AgentName"]  = _issuecardrepo.GetAgentInfo(Agent.AgentId);
                TempData["Issue Date"] = Agent.IssueDate;
                TempData["Card Rule"]  = _cardrepo.GetCardRule(model.CardTypeId);
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("Details", model));
            }
            return(View(model));
        }
        public Htl_AgentCards GetAgentInfoByCardId(int CardId)
        {
            Htl_AgentCards AgentCard = entities.Htl_AgentCards.Where(cc => cc.CardId == CardId).SingleOrDefault();

            return(AgentCard);
        }