/// <summary> /// 新增客户成交信息 /// </summary> /// <param name="customerdeal">实体</param> /// <param name="customerInfo"></param> /// <param name="customerTransactionsFollowUp"></param> /// <param name="customerTransactions"></param> /// <param name="customerFollowUp"></param> /// <param name="cancellationToken">验证</param> /// <returns></returns> public async Task <CustomerDeal> CreateAsync(CustomerDeal customerdeal, CustomerInfo customerInfo, CustomerTransactionsFollowUp customerTransactionsFollowUp, CustomerTransactions customerTransactions, CustomerFollowUp customerFollowUp, CancellationToken cancellationToken = default(CancellationToken)) { if (customerdeal == null) { throw new ArgumentNullException(nameof(customerdeal)); } Context.Attach(customerdeal); Context.Update(customerdeal); if (customerInfo != null) { Context.Attach(customerInfo); Context.Update(customerInfo); } if (customerTransactions != null) { Context.Attach(customerTransactions); Context.Update(customerTransactions); Context.Add(customerTransactionsFollowUp); } if (customerFollowUp != null) { Context.Add(customerFollowUp); } await Context.SaveChangesAsync(cancellationToken); return(customerdeal); }
public async Task UpdateAsync(CustomerDeal customerDeal, CancellationToken cancellationToken = default(CancellationToken)) { if (customerDeal == null) { throw new ArgumentNullException(nameof(customerDeal)); } Context.Attach(customerDeal); Context.Update(customerDeal); try { await Context.SaveChangesAsync(cancellationToken); } catch (DbUpdateConcurrencyException) { throw; } }
/// <summary> /// 新增客户成交信息 /// </summary> /// <param name="customerdeal">实体</param> /// <param name="customerInfo"></param> /// <param name="customerTransactionsFollowUp"></param> /// <param name="customerTransactions"></param> /// <param name="customerFollowUp"></param> /// <param name="cancellationToken">验证</param> /// <returns></returns> public async Task <CustomerDeal> SubmitCreateAsync(CustomerDeal customerdeal, CancellationToken cancellationToken = default(CancellationToken)) { if (customerdeal == null) { throw new ArgumentNullException(nameof(customerdeal)); } try { Context.Add(customerdeal); await Context.SaveChangesAsync(cancellationToken); } catch (DbUpdateConcurrencyException) { throw; } return(customerdeal); }