示例#1
0
文件: User.cs 项目: hessli/Able.Store
        public Receiver GetDefault()
        {
            var defaultReceiver = ReceiveInfos
                                  .FirstOrDefault(x => x.IsDefault == true);

            return(defaultReceiver);
        }
示例#2
0
文件: User.cs 项目: hessli/Able.Store
        public void RemoveReciverInfo(int reciverInfoId)
        {
            var addr = ReceiveInfos.FirstOrDefault(x => x.Id == reciverInfoId);

            if (addr != null)
            {
                ReceiveInfos.Remove(addr);
            }
        }
示例#3
0
文件: User.cs 项目: hessli/Able.Store
        public void ModifyReceiverInfo(Receiver reciverInfo)
        {
            var entity = ReceiveInfos.FirstOrDefault(x => x.Id == reciverInfo.Id);

            if (entity == null)
            {
                throw new ArgumentNullException("指定的收货信息不存在");
            }

            entity.ChangeData(reciverInfo);
        }
示例#4
0
文件: User.cs 项目: hessli/Able.Store
        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);
        }
示例#5
0
文件: User.cs 项目: hessli/Able.Store
        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;
            }
        }