Exemplo n.º 1
0
        public IVote VoteOnArtist(IVote vote)
        {
            IVote voteAdded = new Vote();

            IDataQuery query = new DataQuery();

            query.Where = string.Format("profileId={0} and songId={1} and battlId={2}", vote.ProfileId, vote.SongId, vote.BattlId);
            IVote result = _voteRepository.Find(query).FirstOrDefault();

            if (result != null)
            {
                vote.VoteId = result.VoteId;
                vote.Votes  = result.Votes + 1;
                voteAdded   = _voteRepository.Update(vote);
            }
            else
            {
                voteAdded = _voteRepository.Add(vote);
            }

            query.Where = string.Format("songId={0} and battlId={1}", vote.SongId, vote.BattlId);
            int resultTotal = CanGetVotesByWhere(query.Where).Sum(m => m.Votes);

            vote.Votes = resultTotal;

            return(voteAdded);
        }
Exemplo n.º 2
0
        public IUsuario UpdateAccount(IUsuario usuario)
        {
            IUsuario result = _repository.GetById(usuario.UsuarioId);

            result.Name      = Security.ClearSQLInjection(usuario.Name);
            result.City      = Security.ClearSQLInjection(usuario.City);
            result.Country   = Security.ClearSQLInjection(usuario.Country);
            result.Birthdate = usuario.Birthdate;

            result = _repository.Update(result);

            IActivityLog activityLog1 = new ActivityLog();

            activityLog1.ActionId = 1009;
            activityLog1.Date     = DateTime.Now;
            activityLog1.UserId   = usuario.UsuarioId;
            this._repositoryActivityLog.Add(activityLog1);

            return(result);
        }
Exemplo n.º 3
0
        public void EndActiveBattl()
        {
            IDataQuery query = new DataQuery();

            query.Where = " active=1";
            _battlRepository.Find(query);
            IList <IBattl> _battls = _battlRepository.Collection;

            if (_battls.Count > 0)
            {
                _battls[0].Active = false;
                _battlRepository.Update(_battls[0]);
            }
        }
Exemplo n.º 4
0
        public IProfile UpdateProfile(IProfile profile)
        {
            IProfile result = _repositoryProfile.Update(profile);

            return(result);
        }