Esempio n. 1
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int showId = Convert.ToInt32(Request.QueryString["ShowId"]);

            List <Models.Review> reviews = ReviewController.GetShowReviewByShowId(showId);

            if (reviews.Count > 0)
            {
                lblError.Text = "Show has been reviewed, can't delete show";
            }
            else
            {
                if (ShowController.DeleteShow(showId))
                {
                    Response.Redirect("../Home/HomePage.aspx");
                }
            }
        }
Esempio n. 2
0
        public void DeleteShowShouldFailTest()
        {
            StaticCache.LoadStaticCache();
            ShowController sc = new ShowController();

            var config  = new HttpConfiguration();
            var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost:22121/api/show/DeleteShow");
            var route   = config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}",
                defaults: new { id = RouteParameter.Optional }
                );
            var routeData = new HttpRouteData(route, new HttpRouteValueDictionary {
                { "controller", "show" }
            });

            sc.ControllerContext = new HttpControllerContext(config, routeData, request);
            request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());

            var response = sc.DeleteShow(10000);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.NotFound);
        }
 public async Task DeleteShowTest()
 {
     await _controller.DeleteShow(Guid.NewGuid().ToString());
 }