public ResultObj <List <MachineLocationModel> > GetData(string machineId = "", string startLong = "", string endLong = "", string startLati = "", string endLati = "", string clientId = "", int pageIndex = 1, int pageSize = 10)
        {
            // IProduct service = new ProductService();
            //List<ProductModel> products = service.GetAllProducts();

            MachineLocationModel machineLocationInfo = new MachineLocationModel();

            machineLocationInfo.MachineId = machineId;
            machineLocationInfo.StartLong = startLong;
            machineLocationInfo.EndLong   = endLong;
            machineLocationInfo.StartLati = startLati;
            machineLocationInfo.EndLati   = endLati;
            machineLocationInfo.PageIndex = pageIndex;
            machineLocationInfo.PageSize  = pageSize;
            machineLocationInfo.ClientId  = clientId;
            var data = _IBase.GetAll(machineLocationInfo);

            //int totalcount = 0;

            /*
             * if (string.IsNullOrEmpty(machineId))
             * {
             *  totalcount = _IBase.GetCount(machineLocationInfo);
             * }
             */

            //var pagination = new Pagination { PageSize = pageSize, PageIndex = pageIndex, StartIndex = 0, TotalRows = totalcount, TotalPage = 0 };
            return(Content(data));
        }
Exemple #2
0
        //取附近的机器
        public ResultObj <List <MachineLocationModel> > GetMachineLocations(string longitude = "", string latitude = "", string clientId = "", int pageIndex = 1, int pageSize = 10)
        {
            IWechat iwechat = new WechatService();
            MachineLocationModel machineLocations = new MachineLocationModel();

            machineLocations.PageIndex = pageIndex;
            machineLocations.PageSize  = pageSize;
            machineLocations.Longitude = longitude;
            machineLocations.Latitude  = latitude;
            machineLocations.ClientId  = clientId;
            return(Content(iwechat.GetMachineLocations(machineLocations)));
        }
        public ResultObj <MachineLocationModel> GetLocationByMachineId(string machineId)
        {
            if (string.IsNullOrEmpty(machineId))
            {
                return(Content(new MachineLocationModel()));
            }
            MachineLocationModel machineLocationInfo = new MachineLocationModel();

            machineLocationInfo.MachineId = machineId;
            var lst = _IBase.GetAll(machineLocationInfo);

            if (lst.Count == 0)
            {
                return(Content(new MachineLocationModel()));
            }
            else
            {
                return(Content(lst[0]));
            }
        }
 public ResultObj <int> PutData([FromBody] MachineLocationModel machineLocationInfo)
 {
     return(Content(_IBase.UpdateData(machineLocationInfo)));
 }
 public ResultObj <int> PostData([FromBody] MachineLocationModel machineLocationInfo)
 {
     machineLocationInfo.Id = Guid.NewGuid().ToString();
     return(Content(_IBase.PostData(machineLocationInfo)));
 }