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()); } }
public void Delete <T>(T entity) where T : class => _Context.Remove(entity);