Beispiel #1
0
        public int IncRating(int userId, int photoId)
        {
            Logger.InitLogger();
            int result = 0;

            try
            {
                if (_photoDao.GetLikes(photoId).Contains(userId))
                {
                    return(0);
                }
                if (_photoDao.IncRating(userId, photoId))
                {
                    result = 1;
                    Logger.Log.Info($"Photo id = {photoId} was liked by user id = {userId}");
                }
            }
            catch (Exception e)
            {
                Logger.Log.Error(e.Message);
                result = -1;
            }
            return(result);
        }