コード例 #1
0
        public async Task SetImage(string title, string tags, Uri uri)
        {
            // create reference to SQL database
            var image = new GalleryImage
            {
                Title   = title,
                Tags    = ParseTags(tags), // handle tags that are null. Pass them as a form as a comma seperated from the list
                Url     = uri.AbsoluteUri,
                Created = DateTime.Now
            };

            _dbContext.Add(image);
            await _dbContext.SaveChangesAsync();
        }
コード例 #2
0
        /**
         * Creates a reference to the image in SQL database
         */
        public async Task SetImage(string title, string tags, Uri uri)
        {
            //TODO: make sure to init tags if they are null
            if (tags == null)
            {
                tags = "none";
            }
            var image = new GalleryImage
            {
                Title   = title,
                Tags    = ParseTags(tags),
                Url     = uri.AbsoluteUri,
                Created = DateTime.Now
            };

            _context.Add(image);
            await _context.SaveChangesAsync();
        }