public async Task <FoodMenuBgPhotoForReturnDto> SetBackground(FoodMenuBgPhotoForCreationDto creationDto)
        {
            var photo = await foodMenuBgPhotoService.SetBackgroundPhoto(creationDto);

            var onlineScreens = await onlineScreenService.GetAllOnlineScreenConnectionId();

            if (onlineScreens != null && onlineScreens.Length != 0)
            {
                await kiosksHub.Clients.Clients(onlineScreens).SendAsync("ReloadScreen", true);
            }

            return(photo);
        }
        public async Task <FoodMenuBgPhotoForReturnDto> Create(FileUploadDto uploadDto)
        {
            var uploadFile = await upload.Upload(uploadDto.File, "foodmenu");

            var mapForCreate = new FoodMenuBgPhotoForCreationDto();

            mapForCreate.Name            = uploadFile.Name;
            mapForCreate.FullPath        = uploadFile.FullPath;
            mapForCreate.IsSetBackground = false;
            var mapForDb    = mapper.Map <FoodMenuBgPhoto>(mapForCreate);
            var createPhoto = await foodMenuBgPhotoDal.Add(mapForDb);

            return(mapper.Map <FoodMenuBgPhoto, FoodMenuBgPhotoForReturnDto>(createPhoto));
        }
        public async Task <FoodMenuBgPhotoForReturnDto> Update(FoodMenuBgPhotoForCreationDto updateDto)
        {
            var checkByIdFromRepo = await foodMenuBgPhotoDal.GetAsync(x => x.Id == updateDto.Id);

            if (checkByIdFromRepo == null)
            {
                throw new RestException(HttpStatusCode.BadRequest, new { NotFound = Messages.NotFound });
            }

            var mapForUpdate = mapper.Map(updateDto, checkByIdFromRepo);
            var updatePhoto  = await foodMenuBgPhotoDal.Update(mapForUpdate);

            return(mapper.Map <FoodMenuBgPhoto, FoodMenuBgPhotoForReturnDto>(updatePhoto));
        }