public HttpResponseMessage Get(string memberId) { MemberAddressEntity entity; if (string.IsNullOrEmpty(memberId)) { var user = _workContext.CurrentUser; if (user == null) return PageHelper.toJson(PageHelper.ReturnValue(false, "无法获取当前的用户信息")); entity = _memberAddressService.GetDefaultAddress(user.Id)??_memberService.GetMemberByUserId(user.Id).Address.FirstOrDefault(); } else { entity = _memberAddressService.GetDefaultAddress(memberId)??_memberService.GetMemberById(int.Parse(memberId)).Address.FirstOrDefault(); } if (entity == null) return PageHelper.toJson(null); var model = new MemberAddressModel { Id = entity.Id, Member = entity.Member.Id, Address = entity.Address, Zip = entity.Zip, Linkman = entity.Linkman, Tel = entity.Tel, Adduser = entity.Adduser, Addtime = entity.Addtime, Upduser = entity.Upduser, Updtime = entity.Updtime }; return PageHelper.toJson(model); }
public HttpResponseMessage Get(int id) { var entity =_memberAddressService.GetMemberAddressById(id); if (entity == null) return null; var model = new MemberAddressModel { Id = entity.Id, Member = entity.Member.Id, Address = entity.Address, Zip = entity.Zip, Linkman = entity.Linkman, Tel = entity.Tel, Adduser = entity.Adduser, Addtime = entity.Addtime, Upduser = entity.Upduser, Updtime = entity.Updtime, IsDefault = entity.IsDefault }; return PageHelper.toJson(model); }