public async Task SetImage(string title, string tags, Uri uri)
        {
            var image = new GalleryImage
            {
                Title   = title,
                Tags    = ParseTags(tags),
                Url     = uri.AbsoluteUri,
                Created = DateTime.Now
            };

            _ctx.Add(image);
            await _ctx.SaveChangesAsync();
        }
示例#2
0
        Task IImage.SetImage(string title, string tags, string fileName)
        {
            GalleryImage image = new GalleryImage()
            {
                Title   = title,
                Tags    = ParseTags(tags),
                Url     = "/images/" + fileName,
                Created = DateTime.Now
            };

            _context.Add(image);
            return(_context.SaveChangesAsync());
        }
示例#3
0
        public async Task SetImage(string title, string tags, string uri)
        {
            var image = new GalleryImage()
            {
                Title   = title,
                Tags    = ParseTags(tags),
                Url     = uri,
                Created = DateTime.Now
            };

            _context.Add(image);
            await _context.SaveChangesAsync();
        }
        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/empty :: Pass them as a form as a comma seperated from the list
                Url     = uri.AbsoluteUri,
                Created = DateTime.Now
            };

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