Ejemplo n.º 1
0
 public void ControllerSpecSetUp()
 {
     BranchRepositoryMock = new Mock<IBranchRepository>();
     GamingConsoleRepositoryMock = new Mock<IGamingConsoleRepository>();
     User = new User { BranchName = "branch1" };
     CustomUserIdentity = new CustomUserIdentity(User);
 }
Ejemplo n.º 2
0
        public ViewResult Index(CustomUserIdentity customUserIdentity)
        {
            if (TempData.ContainsKey("Message"))
            {
                ViewBag.Message = TempData["Message"];
            }

            var nonCompletedGameStatuses = gameService.GetNonCompletedGamesStatus(customUserIdentity.BranchName, DateTime.UtcNow.ToIST());
            return View(nonCompletedGameStatuses);
        }
Ejemplo n.º 3
0
 public ActionResult AssignConsole(List<Game> games, CustomUserIdentity userIdentity)
 {
     if (ModelState.IsValid)
     {
         gameRepository.AddMany(games);
         return RedirectToAction("Index");
     }
     RetrieveGamingConsolesAndPutItInViewBag(userIdentity.BranchName);
     return View("AssignConsole", games);
 }
Ejemplo n.º 4
0
        public ViewResult AddCustomer(List<Game> games, CustomUserIdentity userIdentity)
        {
            RetrieveGamingConsolesAndPutItInViewBag(userIdentity.BranchName);

            if (ModelState.IsValid)
            {
                games.Add(new Game { BranchName = userIdentity.BranchName });
                return View("AssignConsole",games);
            }
            return View("AssignConsole",games);
        }
 public ActionResult Create(DailySaleDetails dailySaleDetails, CustomUserIdentity customUserIdentity, string password)
 {
     if (!ModelState.IsValid)
     {
         return View(dailySaleDetails);
     }
     if (password != customUserIdentity.Password)
     {
         ModelState.AddModelError("Password", "Invalid Password");
         return View(dailySaleDetails);
     }
     if (dailySaleDetailsRepository.IsDailySaleClosed(dailySaleDetails.DateTime, customUserIdentity.BranchName))
     {
         ModelState.AddModelError("DateTime", "Daily sale already closed for the given day!");
         return View(dailySaleDetails);
     }
     dailySaleDetails.BranchName = customUserIdentity.BranchName;
     dailySaleDetailsRepository.Add(dailySaleDetails);
     return RedirectToAction("Index", "Game");
 }
Ejemplo n.º 6
0
 public void SetUp()
 {
     user = new User();
     customUserIdentity = new CustomUserIdentity(user);
     customUserPrinciple = new CustomUserPrinciple(customUserIdentity);
 }
Ejemplo n.º 7
0
 public ViewResult RemoveCustomer(List<Game> games, CustomUserIdentity customUserIdentity)
 {
     RetrieveGamingConsolesAndPutItInViewBag(customUserIdentity.BranchName);
     var lastAddedGame = games.Last();
     games.Remove(lastAddedGame);
     return View("AssignConsole", games);
 }
Ejemplo n.º 8
0
 public ViewResult NonCompletedGames(CustomUserIdentity customUserIdentity)
 {
     return View(gameRepository.GetNonCompletedGames(customUserIdentity.BranchName, DateTime.UtcNow.ToIST()));
 }
Ejemplo n.º 9
0
 public ViewResult AssignConsole(CustomUserIdentity customUserIdentity)
 {
     RetrieveGamingConsolesAndPutItInViewBag(customUserIdentity.BranchName);
     var games = new List<Game> {new Game { BranchName = customUserIdentity.BranchName }};
     return View(games);
 }
Ejemplo n.º 10
0
        public ViewResult Membership(string membershipId, CustomUserIdentity customUserIdentity)
        {
            var membership = membershipRepository.FindByMembershipId(membershipId);

            if (membership == null)
            {
                ModelState.AddModelError("membershipId", "Membership Id doesn't exists.");
                return View();
            }

            if (membership.IsExpired)
            {
                ModelState.AddModelError("membershipId", "Membership Id is expired. Kindly recharge.");
                return View();
            }

            RetrieveGamingConsolesAndPutItInViewBag(customUserIdentity.BranchName);

            return View("AssignConsole",
                new MembershipAssignConsoleViewModel
                    {
                        Membership = membership, Game = new Game { GamePaymentType = GamePaymentType.Membership, BranchName = customUserIdentity.BranchName, Price = 0}
                    });
        }
Ejemplo n.º 11
0
 public ViewResult Create(CustomUserIdentity customUserIdentity)
 {
     return View(new Membership{ BranchName = customUserIdentity.BranchName});
 }
Ejemplo n.º 12
0
        public ViewResult Recharge(CustomUserIdentity customUserIdentity)
        {
            var membershipReCharge = new MembershipReCharge {BranchName = customUserIdentity.BranchName};

            return View(membershipReCharge);
        }
Ejemplo n.º 13
0
 public CustomUserPrinciple(CustomUserIdentity userIdentity)
 {
     this.userIdentity = userIdentity;
 }
Ejemplo n.º 14
0
 public void SetUp()
 {
     user = new User();
     customUserIdentity = new CustomUserIdentity(user);
 }