Exemple #1
0
        public void CreateUserPhotoAction(int?userId, int photoId, UserPhotoActionType actionType, bool preventDuplicate)
        {
            if (preventDuplicate && userId != null && HasUserPhotoAction((int)userId, photoId, actionType))
            {
                return;
            }

            var userPhotoAction = new UserPhotoActionModel {
                UserId = userId, PhotoId = photoId, ActionType = actionType
            };

            UserPhotoActions.Add(userPhotoAction);
            SaveChanges();
        }
Exemple #2
0
 public int FindUserPhotoActionsCountByType(int photoId, UserPhotoActionType actionType)
 {
     return(UserPhotoActions.Count(upa => upa.PhotoId == photoId && upa.ActionType == actionType));
 }
Exemple #3
0
 public bool HasUserPhotoAction(int userId, int photoId, UserPhotoActionType actionType)
 {
     return(UserPhotoActions.Any(upa => upa.UserId == userId && upa.PhotoId == photoId && upa.ActionType == actionType));
 }
Exemple #4
0
 public List <UserModel> FindUserPhotoActionsByType(int photoId, UserPhotoActionType actionType)
 {
     return(UserPhotoActions.Where(upa => upa.PhotoId == photoId && upa.ActionType == actionType).Select(upa => upa.User).ToList());
 }