예제 #1
0
        public async Task Put()
        {
            //Arrange
            var get = await controller.Get(1);

            var okgetResult = Assert.IsType <OkObjectResult>(get);
            var entity      = Assert.IsType <markers>(okgetResult.Value);


            var newEntity = new markers();

            newEntity.marker = "chalk test";
            //should test the equals Equatable for all these too
            var huh = entity.Equals(newEntity);

            entity.marker = "testEdit";
            //Act
            var response = await controller.Put(1, entity);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(response);
            var result   = Assert.IsType <markers>(okResult.Value);

            Assert.Equal(entity.marker, result.marker);
        }
예제 #2
0
 public async Task <IActionResult> Put(int id, [FromBody] markers entity)
 {
     try
     {
         if (id < 0 || !isValid(entity))
         {
             return(new BadRequestResult());
         }
         return(Ok(await agent.Update <markers>(id, entity)));
     }
     catch (Exception ex)
     {
         return(await HandleExceptionAsync(ex));
     }
 }
예제 #3
0
 public async Task <IActionResult> Post([FromBody] markers entity)
 {
     try
     {
         if (!isValid(entity))
         {
             return(new BadRequestResult());
         }
         //sm(agent.Messages);
         return(Ok(await agent.Add <markers>(entity)));
     }
     catch (Exception ex)
     {
         //sm(agent.Messages);
         return(await HandleExceptionAsync(ex));
     }
 }
예제 #4
0
        public async Task Post()
        {
            //Arrange
            var entity = new markers()
            {
                marker = "TestPost"
            };


            //Act
            var response = await controller.Post(entity);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(response);
            var result   = Assert.IsType <markers>(okResult.Value);


            Assert.Equal("TestPost", result.marker);
        }
예제 #5
0
        public ActionResult Index()
        {
            //////////////////////生成图表////////////////////////////////////////////
            var options = new
            {
                xAxis = new XAxis
                {
                    data = new List <string>()
                    {
                        "0", "3", "6", "9", "12"
                    },
                    type = "category",
                },
                yAxis = new YAxis
                {
                    type = "value"
                },
                series = new Series
                {
                    data = new List <int>()
                    {
                        100, 110, 120, 130, 100, 133, 90, 180, 70
                    },
                    type = "line"
                }
            };

            Session["option"] = JsonConvert.SerializeObject(options);

            //////////////////////生成图表////////////////////////////////////////////

            //会员车辆
            ViewBag.hcar = OW.BLL.DataManager.GetCarsByType(2).Count;
            //充值
            ViewBag.ccar = OW.BLL.DataManager.GetCarsByType(3).Count;
            //外来
            ViewBag.wcar = OW.BLL.DataManager.GetCarsByType(1).Count;

            ViewBag.pcount = OW.BLL.DataManager.GetParkingInfos();

            ViewBag.scared = OW.BLL.DataManager.GetCarSettled();


            ///////////////////////////////////////////////////////////////////////////////////
            List <CarSettledInfo> listCar = OW.BLL.DataManager.GetCarSettledList();

            List <markers> markersList = new List <markers>();


            int count = 0;

            foreach (CarSettledInfo info in listCar)
            {
                if (count == 0)
                {
                    int x = new Random().Next(10, 400), y = new Random().Next(10, 250);

                    markers s = new markers()
                    {
                        coords = new int[] { x, y },
                        name   = info.License,
                        style  =
                            new style()
                        {
                            fill = "red"
                        }
                    };
                    markersList.Add(s);
                }
                else
                {
                    int x = new Random().Next(10, 400), y = new Random().Next(10, 250);

                    markers s = new markers()
                    {
                        coords = new int[] { x, y },
                        name   = info.License,
                        style  =
                            new style()
                        {
                            fill = "green"
                        }
                    };
                    markersList.Add(s);
                }

                count++;
            }

            var map = new
            {
                map     = "map",
                markers = markersList
            };

            //var map = new {
            //    map = "map",
            //    markers = new List<markers>(){
            //       new markers(){
            //        coords =new int []{ 200,300},
            //        name = "车辆1",
            //        style =
            //           new style(){ fill="red"}
            //       },
            //       new markers(){
            //        coords = new int []{ 230,300},
            //        name = "车辆2",
            //        style =
            //           new style(){ fill="red"}
            //       },
            //        new markers(){
            //        coords = new int []{ 250,30},
            //        name = "车辆2",
            //        style =
            //           new style(){ fill="red"}
            //       }
            //    }
            //};

            Session["map"] = JsonConvert.SerializeObject(map);

            return(View());
        }