public async void FetchDestStructAsync() { App.Dispatcher.Invoke(() => { IsDestStructFetchEnabled = false; }); var provinces = await HttpClient.GetDestStructAsync(); lock (Provinces) { App.Dispatcher.Invoke(() => { if (provinces == null) { State.Message = "加载错误"; } else { int index = ProvinceIndex; Provinces.ReplaceItems(provinces); Provinces.Insert(0, FrameWork.Dto.Province.All); if (index >= 0 && index < Provinces.Count) { ProvinceIndex = index; } else { ProvinceIndex = 0; } } }); } App.Dispatcher.Invoke(() => { IsDestStructFetchEnabled = true; }); }
public ActionResult Edit(ProvinceEditModel model) { if (ModelState.IsValid) { short sysMessageId = 0; byte sysMessageTypeId = 0; model.SystemStatus = SystemStatus.Error; var province = new Provinces { CountryId = model.CountryId, ProvinceId = model.ProvinceId, ProvinceName = model.ProvinceName, ProvinceDesc = model.ProvinceDesc, DisplayOrder = model.DisplayOrder, CrUserId = model.CrUserId, CrDateTime = model.CrDateTime }; sysMessageTypeId = model.CountryId > 0 ? province.Update(0, _userId, ref sysMessageId) : province.Insert(0, _userId, ref sysMessageId); if (sysMessageId > 0) { var sysMessage = new SystemMessages().Get(sysMessageId); if (sysMessageTypeId == CmsConstants.SystemMessageIdSuccess) { model.SystemStatus = SystemStatus.Success; } ModelState.AddModelError("SystemMessages", sysMessage.SystemMessageDesc); } else { ModelState.AddModelError("SystemMessages", "Bạn vui lòng thử lại sau."); } } return(View(model)); }