Пример #1
0
        public void DeleteTest()
        {
            //Arrange
            var seedDB = new List <MovieOrderModelDAL>();
            var seed   = new MovieOrderModelDAL
            {
                RentedMovieId        = 1,
                ID                   = 1,
                RentalStartTimeStamp = DateTime.Now.ToString(),
                Email                = "*****@*****.**"
            };

            seedDB.Add(seed);
            var controller = new MovieOrdersLogic(new MovieOrderDALStub(seedDB));
            var rightInput = 1;
            var wrongInput = -1;

            //Act
            var result1 = controller.Delete(rightInput);
            var result2 = controller.Delete(wrongInput);

            //Assert
            Assert.IsTrue(result1 && !result2);
        }
Пример #2
0
        public JsonResult Delete(int movieOrderId)
        {
            if (Session["LoggedIn"] == null || Session["LoggedIn"].Equals(false))
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }

            var result = _movieOrdersLogic.Delete(movieOrderId);

            if (result)
            {
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }