public void FillMobileBackground(MobileBackgroundModel mobileBackground) { var account = RootRepository.AccountRepository.GetCurrentLoggedInAccount(); var hotel = account.Hotels.FirstOrDefault(); if (hotel == null || hotel.HotelDetail == null) { return; } mobileBackground.MobileBackground = hotel.HotelDetail.MobileBackgroundImage != null ? new ImageModel(hotel.HotelDetail.MobileBackgroundImage) : null; }
public void UpdateMobileBackground(MobileBackgroundModel model) { var account = RootRepository.AccountRepository.GetCurrentLoggedInAccount(); var hotel = account.Hotels.FirstOrDefault(); //TODO: JD: Throw Error if (hotel == null || hotel.HotelDetail == null) { return; } var mobileBackground = model.MobileBackground != null?Rp.ExecuteAction( () => (from cI in Context.Images where cI.PKID == model.MobileBackground.PKID select cI)).FirstOrDefault() : null; if (mobileBackground != null) { hotel.HotelDetail.MobileBackgroundImage = mobileBackground; } Context.LogValidationFailSaveChanges(RootRepository.SecurityRepository.AuditLogUserId); }