Ejemplo n.º 1
0
		public bool Delete(MemberAddressEntity entity)
		{
			try
            {
                _memberaddressRepository.Delete(entity);
                return true;
            }
            catch (Exception e)
            {
				_log.Error(e,"数据库操作出错");
                return false;
            }
		}
Ejemplo n.º 2
0
		public MemberAddressEntity Update (MemberAddressEntity entity)
		{
			try
            {
                _memberaddressRepository.Update(entity);
                return entity;
            }
            catch (Exception e)
            {
				_log.Error(e,"数据库操作出错");
                return null;
            }
		}
        public HttpResponseMessage Post([FromBody]MemberAddressModel model)
		{
			var entity = new MemberAddressEntity
			{
				Member = _memberService.GetMemberByUserId(model.UserId),
				Address = model.Address,
				Zip = model.Zip,
				Linkman = model.Linkman,
				Tel = model.Tel,
				Adduser = _workContext.CurrentUser.Id,
				Addtime = DateTime.Now,
				Upduser = _workContext.CurrentUser.Id,
				Updtime = DateTime.Now,
                Area = _areaService.GetAreaById(model.AreaId),
                IsDefault = model.IsDefault
			};
			if(_memberAddressService.Create(entity).Id > 0)
			{
                return PageHelper.toJson(PageHelper.ReturnValue(true, "post 成功"));
			}
            return PageHelper.toJson(PageHelper.ReturnValue(false, "post  失败")); 
		}