Exemplo n.º 1
0
        public void AddBackground(BackgroundDto backgroundDto, string path)
        {
            var background = Mapper.Map <Background>(backgroundDto);

            background.CreationTime         = DateTime.Now;
            background.LastModificationTime = DateTime.Now;
            background.DeletionTime         = DateTime.Now;
            background.IsActive             = true;
            _backgroundService.Insert(background);
            SaveChanges();

            var changeResturentBackground = _restaurantService.GetRestaurantByAdminId(backgroundDto.UserId);

            changeResturentBackground.BackgroundId = background.BackgroundId;
            _restaurantService.Update(changeResturentBackground);
            SaveChanges();
            _manageStorage.UploadImage(path + "\\" + "Background", backgroundDto.Image, background.BackgroundId.ToString());
        }