Example #1
0
        public FFolder CreateIfNotExist(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }
            else
            {
                //Not exist
                //Not exist parent
                var v = db.FFolders.Where(r => (path.Contains(r.Path) || r.Path == path) && r.UserId == Flickr.User.UserId).FirstOrDefault();

                if (v == null)
                {
                    v = db.FFolders.Add(new FFolder()
                    {
                        Path = path, UserId = Flickr.User.UserId
                    });
                    db.SaveChanges();
                }
                else
                {
                    MessageBox.Show("Folder or parent folder existing.");
                }

                return(v);
            }
        }
Example #2
0
        public FUser CreateOrUpdate(string userID, string oAuthAccessToken, string oAuthAccessTokenSecret, string userName, string fullName)
        {
            FUser v = db.FUsers.FirstOrDefault();

            if (v == null)
            {
            }
            else
            {
                db.FUsers.Remove(v);
            }

            v = db.FUsers.Add(new FUser()
            {
                UserId = userID, OAuthAccessToken = oAuthAccessToken, OAuthAccessTokenSecret = oAuthAccessTokenSecret
            });

            db.SaveChanges();

            return(v);
        }
Example #3
0
        public Set AddOrUpdate(Photoset set)
        {
            var v = db.Sets.FirstOrDefault(r => r.UserID == Flickr.User.UserId && r.SetsID == set.PhotosetId);

            if (v == null)
            {
                db.Sets.Add(new Set()
                {
                    UserID = Flickr.User.UserId, SetsID = set.PhotosetId, Tittle = set.Title
                });
            }
            else
            {
                if (v.Tittle != set.Title)
                {
                    v.Tittle = set.Title;
                }
            }

            db.SaveChanges();

            return(v);
        }