/// <summary> /// 修改实体 /// </summary> /// <param name="input"></param> /// <returns></returns> protected virtual async Task UpdateProvinceCityAsync(CreateOrUpdateProvinceCityInput input) { Debug.Assert(input.ProvinceCity.Id != null, "input.ProvinceCity.Id should be set."); var provinceCity = await _provinceCityRepository.GetAsync(input.ProvinceCity.Id); provinceCity = input.ProvinceCity.MapTo<BaseProvinceCityInfo>(); provinceCity.LastModifierUserId = YLSession.UserId; provinceCity.LastModifierUserName = ""; provinceCity.LastModificationTime = Clock.Now; await _provinceCityRepository.UpdateAsync(provinceCity); cacheHandler.Remove(CacheCategoryProvinceCity, "GetProvinceCityList"); }
/// <summary> /// 添加修改实体 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task CreateOrUpdateProvinceCity(CreateOrUpdateProvinceCityInput input) { if (input.ProvinceCity.Id != null && input.ProvinceCity.Id != Guid.Empty) { await UpdateProvinceCityAsync(input); } else { await CreateProvinceCityAsync(input); } }
/// <summary> /// 创建实体 /// </summary> /// <param name="input"></param> /// <returns></returns> protected virtual async Task CreateProvinceCityAsync(CreateOrUpdateProvinceCityInput input) { var provinceCity = input.ProvinceCity.MapTo<BaseProvinceCityInfo>(); provinceCity.CreatorUserId = YLSession.UserId; provinceCity.CreatorUserName = ""; provinceCity.CreationTime = Clock.Now; await _provinceCityRepository.InsertAsync(provinceCity); cacheHandler.Remove(CacheCategoryProvinceCity, "GetProvinceCityList"); }
protected async virtual Task CreateProvinceCityAsync(CreateOrUpdateProvinceCityInput input) { var provinceCity = input.ProvinceCity.MapTo<BaseProvinceCityInfo>(); provinceCity.CreatorUserId = AbpSession.UserId; provinceCity.Id = GuidHelper.NewGuid(); provinceCity.CreatorUserName = GetCurrentUser().RealName; provinceCity.CreationTime = Clock.Now; await _provinceCityRepository.InsertAsync(provinceCity); cacheHandler.Remove(CacheCategoryProvinceCity, "GetProvinceCityList"); }