// GET: MatchingDevice/index public ActionResult Index() { var devices = this.deviceService.Get().ToList(); var deviceVMs = new List <Models.MatchingDeviceVM>(); foreach (var item in devices) { var location = locationService.Get(item.Screen.LocationID); var locationString = location.Address + ", Quận " + location.District + ", TP." + location.Province; var b = new Models.MatchingDeviceVM { Location = locationString, DeviceId = item.DeviceID, Description = item.Description, BoxName = boxService.GetBoxNameByID(item.BoxID), ScreenName = screenService.GetScreenNameByID(item.ScreenID), Title = item.Title, MatchingCode = item.MatchingCode, IsHorizontal = item.Screen.isHorizontal }; deviceVMs.Add(b); } ViewBag.devicesList = deviceVMs; ViewBag.locationStringList = GetLocationIdByBrandId(); ViewBag.addSuccess = Session["ADD_RESULT"] ?? false; ViewBag.updateSuccess = Session["UPDATE_RESULT"] ?? false; Session.Clear(); return(View()); }