예제 #1
0
        public async Task <IActionResult> Create()
        {
            var model = new ProfileViewModel();

            // devices
            var devices = await locationService.GetDevices();

            var deviceList = new List <SelectListItem>();

            deviceList.Add(new SelectListItem {
                Value = "", Text = "Выберите значение"
            });
            deviceList.AddRange(devices.Select(x => new SelectListItem {
                Value = x.Id.ToString(), Text = x.Imei
            }).ToList());
            ViewBag.Devices = deviceList;


            return(View("Edit", model));
        }
예제 #2
0
        public async Task <IActionResult> GetDevices()
        {
            var result = await locationService.GetDevices();

            return(Ok(result.ToList()));
        }