コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <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);
     }
 }
コード例 #3
0
        /// <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);
        }