public async Task UpdatePhoto(UpdatePhotoReq req, DatabaseContext context) { var expertProfile = await context.ExpertProfiles .Include(p => p.User) .SingleAsync(profile => profile.Id == req.ExpertProfileId); expertProfile.PhotoImageUrl = req.PhotoUrl; expertProfile.ThumbnailImageUrl = req.PhotoUrl; if (expertProfile.IsPublished) { this.ThrowIfPublishingBroken(expertProfile); } }
public async Task UpdatePhoto(UpdatePhotoReq req, DatabaseContext context) { var currentUserData = this._currentUserService.GetCurrentUserData(); var e = await context.Events .SingleAsync(ee => ee.Id == req.EventId && ee.Company.UserId == currentUserData.Id); e.LogoImageUrl = req.PhotoUrl; if (e.IsPublished) { this.ThrowIfPublishingBroken(e); } }
public async Task UpdatePhoto(UpdatePhotoReq req, DatabaseContext context) { var currentUserData = this._currentUserService.GetCurrentUserData(); var company = await context.Companies .SingleAsync(c => c.Id == req.CompanyId && c.UserId == currentUserData.Id); company.LogoImageUrl = company.ThumbnailImageUrl = req.PhotoUrl; if (company.IsPublished) { this.ThrowIfPublishingBroken(company); } }