public ActionResult GetSoDoGheXe(int NhaXeId, int CustomerId, int XeXuatBenId, string apiToken) { //kiem tra xac thuc string _checkauthentication = isAuthentication(NhaXeId, CustomerId, apiToken, XeXuatBenId); if (!String.IsNullOrEmpty(_checkauthentication)) { return(ErrorOccured(_checkauthentication)); } //lay thong tin so do ghe xe var sodoghequytacs = _xeinfoService.GetAllSoDoGheXeQuyTac(xexuatben.xevanchuyen.LoaiXeId); var phoives = new List <PhoiVeMobileModel>(); //kiem tra trang thai tung ghe tren so do foreach (var sodo in sodoghequytacs) { var item = new PhoiVeMobileModel(); //thong tin ghe/vi tri tri item.Val = sodo.Val; item.x = sodo.x; item.y = sodo.y; item.Tang = sodo.Tang; item.SoDoGheXeQuyTacId = sodo.Id; //thong tin trang thai vi tri var phoive = _phoiveService.GetPhoiVe(xexuatben.NguonVeId, sodo, xexuatben.NgayDi, true); item.Id = phoive.Id; item.TrangThaiId = phoive.TrangThaiId; item.NguonVeXeId = xexuatben.NguonVeId; item.NgayDi = phoive.NgayDi.toStringDate(); item.GiaVe = Convert.ToInt32(phoive.GiaVeHienTai); item.CustomerId = phoive.CustomerId; item.ChangId = phoive.ChangId.GetValueOrDefault(0); item.VeXeItemId = phoive.VeXeItemId.GetValueOrDefault(0); item.MaVe = phoive.MaVe; if (phoive.customer != null) { item.TenKhachHang = phoive.customer.GetFullName(); item.SoDienThoai = phoive.customer.GetPhone(); } if (String.IsNullOrEmpty(phoive.ViTriXuongXe) && phoive.nguonvexe != null) { item.ViTriXuong = phoive.nguonvexe.GetDiemDen(); } else { if (phoive.nguonvexe != null) { item.ViTriXuong = phoive.ViTriXuongXe; } } if (phoive.nguonvexecon != null) { item.ViTriXuong = phoive.nguonvexecon.TenDiemDen; } phoives.Add(item); } return(Successful(phoives)); }