public ActionResult AddMembership(MembershipModel Memship)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    MembershipRepository MemshipRepo = new MembershipRepository();
                    MemshipRepo.AddMembership(Memship);

                    var      profileData = this.Session["UserProfile"] as UserSession;
                    LogModel logModel    = new LogModel()
                    {
                        UserId    = profileData.UserID,
                        TableName = "Membership",
                        Activity  = "Added Membership",
                        LogDate   = DateTime.Now
                    };
                    logRepository logRepository = new logRepository();
                    logRepository.AddLog(logModel);
                }

                return(RedirectToAction("GetAllMembershipDetails"));
            }
            catch
            {
                return(RedirectToAction("GetAllMembershipDetails"));
            }
        }
        public void AddMembership(Membership memship)
        {
            double dbsize = _user.Getdbsize();

            if (dbsize >= 4.50)
            {
            }
            if (memship.MemberID != null)
            {
                string userid = HttpContext.Session.GetString("UserID");
                _membership.AddMembership(memship, userid);
            }
        }
Exemplo n.º 3
0
        public IActionResult Create(Membership memship)
        {
            double dbsize = _user.Getdbsize();

            if (dbsize >= 4.50)
            {
                return(View());
            }

            if (string.IsNullOrEmpty(HttpContext.Session.GetString("UserName")))
            {
                TempData["msg"] = "<script>ModalPopupsAlert('Loyalty','  Session Expired! Login Again... ');</script>";
                return(RedirectToAction("Login", "User"));
            }

            if (ModelState.IsValid && memship.MemberID != null)
            {
                string userid = HttpContext.Session.GetString("UserID");
                _membership.AddMembership(memship, userid);
                return(RedirectToAction("Index"));
            }
            return(View());
        }