public void SaveUpdateRank(int customerId, CustomerRelations lastCrm) { var state = GetAll().FirstOrDefault(x => x.CustomerId == customerId); if (state != null) { state.Status = lastCrm.Status; state.Rank = lastCrm.Rank; } else { state = new CustomerRelationState { CustomerId = customerId, Rank = lastCrm.Rank, Status = lastCrm.Status }; } SaveOrUpdate(state); }
public void SaveUpdateState(int customerId, bool isFollowUp, CustomerRelationFollowUp followUp, CustomerRelations lastCrm) { var state = GetAll().FirstOrDefault(x => x.CustomerId == customerId); if (state != null) { state.IsFollowUp = isFollowUp; state.FollowUp = followUp; state.Rank = lastCrm == null ? null : lastCrm.Rank; state.Status = lastCrm == null ? null : lastCrm.Status; } else { state = new CustomerRelationState { CustomerId = customerId, IsFollowUp = isFollowUp, FollowUp = followUp, Rank = lastCrm == null ? null : lastCrm.Rank, Status = lastCrm == null ? null : lastCrm.Status }; } SaveOrUpdate(state); }