public async Task <bool> AddPhotoAsync(string title, string ownerId, byte[] content) { var fileName = await SavePhotoContentAsync(content); var entity = new PhotoEntity { Title = title, OwnerId = ownerId, FileName = fileName }; await dbContext.Photos.AddAsync(entity); return(await dbContext.SaveChangesAsync() >= 0); }
public async Task <bool> DeletePhotoAsync(PhotoEntity photo) { dbContext.Photos.Remove(photo); return(await dbContext.SaveChangesAsync() >= 0); }