Ejemplo n.º 1
0
		public bool Delete(FollowerEntity entity)
		{
			try
            {
                _followerRepository.Delete(entity);
                return true;
            }
            catch (Exception e)
            {
				_log.Error(e,"数据库操作出错");
                return false;
            }
		}
Ejemplo n.º 2
0
		public FollowerEntity Update (FollowerEntity entity)
		{
			try
            {
                _followerRepository.Update(entity);
                return entity;
            }
            catch (Exception e)
            {
				_log.Error(e,"数据库操作出错");
                return null;
            }
		}
Ejemplo n.º 3
0
        public HttpResponseMessage AddFollower(FollowerModel followerModel)
        {
            if (followerModel != null)
            {
                var followerentity = new FollowerEntity
                {
                    Openid = followerModel.Openid,
                    Nickname = followerModel.Nickname,
                    Sex = followerModel.Sex,
                    City = followerModel.City,
                    Country = followerModel.Country,
                    Private = followerModel.Private,
                    Language = followerModel.Language,
                    Headimgurl = followerModel.Headimgurl,
                    Subscribetime = followerModel.Subscribe_time,
                    Unioid = followerModel.Unioid,
                    Remark = followerModel.Remark,
                    Groupid = followerModel.Groupid,
                    Adduser = followerModel.Adduser,
                    Addtime = DateTime.Now,
                    Upuser = followerModel.Upuser,
                    Uptime = DateTime.Now
                };
                var phoneentity = new PhoneEntity
                {
                    Follower = _followerService.Create(followerentity),
                    Openid = followerModel.Openid,
                    Phone = followerModel.Phone,
                    Adduser = followerModel.Adduser,
                    Addtime = DateTime.Now,
                    Upuser = followerModel.Upuser,
                    Uptime = DateTime.Now
                };
                try
                {
                    _phoneService.Create(phoneentity);
                    return PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功!"));
                }
                catch
                {
                    return PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败!"));
                }
            }
            return PageHelper.toJson(PageHelper.ReturnValue(false, "数据验证错误!"));

        }