public Receiver GetDefault() { var defaultReceiver = ReceiveInfos .FirstOrDefault(x => x.IsDefault == true); return(defaultReceiver); }
public void RemoveReciverInfo(int reciverInfoId) { var addr = ReceiveInfos.FirstOrDefault(x => x.Id == reciverInfoId); if (addr != null) { ReceiveInfos.Remove(addr); } }
public void ModifyReceiverInfo(Receiver reciverInfo) { var entity = ReceiveInfos.FirstOrDefault(x => x.Id == reciverInfo.Id); if (entity == null) { throw new ArgumentNullException("指定的收货信息不存在"); } entity.ChangeData(reciverInfo); }
public Receiver GetPointReceiver(int?receiverId = null) { Expression <Func <Receiver, bool> > expre = x => true; if (receiverId.HasValue && receiverId.Value != default(int)) { expre = expre.And(x => x.Id == receiverId); } var entity = ReceiveInfos.FirstOrDefault(expre.Compile()); return(entity); }
public void SetDefaultReciverInfo(int addressId) { var reciverInfo = ReceiveInfos.FirstOrDefault(x => x.Id == addressId); if (reciverInfo != null) { ReceiveInfos.ToList() .ForEach(x => x.IsDefault = false); reciverInfo.IsDefault = true; } }