コード例 #1
0
        public async Task <IActionResult> TryDiscardChange([Bind("BaseImageTag,VolumeID,UserID,Tag,CreateTime,LastModifiedTime")] Image image)
        {
            try
            {
                var user = await _userManager.GetUserAsync(this.User);

                image = await validateImage(user, image);

                return(Ok());
            }
            catch (ArgumentException)
            {
                image = await _context.Image.FirstOrDefaultAsync(f => f.Tag == image.Tag);

                _context.Remove(image);
                await _context.SaveChangesAsync();

                return(Ok());
            }
        }
コード例 #2
0
 public void Delete <T>(T entity) where T : class => _Context.Remove(entity);