/// <summary> /// 更新区域 /// </summary> /// <param name="input"></param> /// <returns></returns> protected virtual async Task UpdateDistrict(CreateOrUpdateDistrictInput input) { var district = await _stateManager.GetDistrictByIdAsync(input.Id.Value); district.CityId = input.CityId; district.Name = input.Name; district.IsActive = input.IsActive; district.DisplayOrder = input.Display; await _stateManager.UpdateDistrictAsync(district); }
/// <summary> /// 创建或更新区域 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task CreateOrUpdateDistrict(CreateOrUpdateDistrictInput input) { if (input.Id.HasValue) { await UpdateDistrict(input); } else { await CreateDistrict(input); } }
/// <summary> /// 创建区域 /// </summary> /// <param name="input"></param> /// <returns></returns> protected virtual async Task CreateDistrict(CreateOrUpdateDistrictInput input) { var district = new District() { CityId = input.CityId, Name = input.Name, IsActive = input.IsActive, DisplayOrder = input.Display, }; await _stateManager.CreateDistrictAsync(district); }