public ActionResult DeleteConfirmed(int id)
        {
            TrendRequest trendRequest = db.TrendRequest.Find(id);

            db.TrendRequest.Remove(trendRequest);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public ActionResult AcceptConfirmed(int id)
        {
            TrendRequest trendRequest = db.TrendRequest.Find(id);
            var          modelT       = new Trend();

            modelT.Product_ID = trendRequest.Product_ID;
            db.Trend.Add(modelT);
            db.TrendRequest.Remove(trendRequest);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Create([Bind(Include = "ID,Product_ID")] TrendRequest trendRequest)
        {
            if (ModelState.IsValid)
            {
                db.TrendRequest.Add(trendRequest);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Product_ID = new SelectList(db.Product, "ID", "ProductName", trendRequest.Product_ID);
            return(View(trendRequest));
        }
        // GET: SellerTrendRequest/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TrendRequest trendRequest = db.TrendRequest.Find(id);

            if (trendRequest == null)
            {
                return(HttpNotFound());
            }
            return(View(trendRequest));
        }
Пример #5
0
        public void SetUp()
        {
            currentTime = DateTime.UtcNow.ToIST();
            trendRequest = new TrendRequest { BranchName = "foo", From = DateTime.UtcNow, To = DateTime.UtcNow.AddDays(5) };
            gamingConsoles = new List<GamingConsole>
                                 {
                                     new GamingConsole {BranchName = "Branch1", Name = nameOfConsole1},
                                     new GamingConsole {BranchName = "Branch2", Name = nameOfConsole2},
                                     new GamingConsole {BranchName = "Branch1", Name = nameOfConsole3},
                                     new GamingConsole {BranchName = "Branch2", Name = nameOfConsole4},
                                 };
            games = new List<Game>
                        {
                            new Game
                                {
                                    BranchName = "Branch2",
                                    ConsoleName = nameOfConsole2,
                                    InTime = currentTime,
                                    OutTime = currentTime.AddHours(1),
                                    CustomerName = "foo"
                                },
                            new Game
                                {
                                    BranchName = "Branch2",
                                    ConsoleName = nameOfConsole2,
                                    InTime = currentTime,
                                    OutTime = currentTime.AddHours(2),
                                    CustomerName = "bar"
                                },
                            new Game
                                {
                                    BranchName = "Branch1",
                                    ConsoleName = nameOfConsole3,
                                    InTime = currentTime,
                                    OutTime = currentTime.AddHours(1),
                                    CustomerName = "foo"
                                },
                            new Game
                                {
                                    BranchName = "Branch1",
                                    ConsoleName = nameOfConsole3,
                                    InTime = currentTime,
                                    OutTime = currentTime.AddHours(2),
                                    CustomerName = "bar"
                                }
                        };
            gamingConsoleRepositoryMock = new Mock<IGamingConsoleRepository>();
            gameRepositoryMock = new Mock<IGameRepository>();
            membershipRepositoryMock = new Mock<IMembershipRepository>();
            gamingTrendMock = new Mock<IGamingTrend>();

            gamingConsoleRepositoryMock
                .Setup(repo => repo.GetGamingConsolesByBranchName("Branch1"))
                .Returns(gamingConsoles.Where(console => console.BranchName == "Branch1"));
            gamingConsoleRepositoryMock
                .Setup(repo => repo.GetGamingConsolesByBranchName("Branch2"))
                .Returns(gamingConsoles.Where(console => console.BranchName == "Branch2"));

            gameService = new GameService(gameRepositoryMock.Object, gamingConsoleRepositoryMock.Object, membershipRepositoryMock.Object, gamingTrendMock.Object);
        }