Ejemplo n.º 1
0
 private static void CheckError(CreateOrUpdateAdvertAccountInput input)
 {
     if (input.StoreId == 0)
     {
         throw new UserFriendlyException("请选择店铺");
     }
 }
Ejemplo n.º 2
0
        protected virtual async Task <AdvertAccount> UpdateAccountAsync(CreateOrUpdateAdvertAccountInput input)
        {
            var account = ObjectMapper.Map <AdvertAccount>(input);
            await _advertAccountManager.UpdateAsync(account);

            return(account);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 创建或更新广告账户
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public virtual async Task <EntityDto <long> > CreateOrUpdateAccount(CreateOrUpdateAdvertAccountInput input)
        {
            CheckError(input);

            AdvertAccount account;

            if (input.Id.HasValue && input.Id.Value > 0)
            {
                account = await UpdateAccountAsync(input);
            }
            else
            {
                account = await CreateAccountAsync(input);
            }

            await CurrentUnitOfWork.SaveChangesAsync();

            return(new EntityDto <long> {
                Id = account.Id
            });
        }