static void InsertAuction(AuctionViewModel newAuction)
        {
            List <AuctionPhoto> ConvertedPaths = new List <AuctionPhoto>();

            Auction auctionToAdd = new Auction();



            if (newAuction.Photos != null)
            {
                foreach (var photo in newAuction.Photos)
                {
                    AuctionPhoto auctionPhoto = new AuctionPhoto
                    {
                        PhotoPath = ImageTool.SaveImage(photo, _enviroment),
                        Auction   = auctionToAdd
                    };
                    _context.AuctionPhotos.Add(auctionPhoto);
                    ConvertedPaths.Add(auctionPhoto);
                }
            }
            else
            {
                ConvertedPaths.Add(new AuctionPhoto
                {
                    PhotoPath = "default.png",
                    Auction   = auctionToAdd
                });
            }



            auctionToAdd.Title       = newAuction.Title;
            auctionToAdd.Description = newAuction.Description;
            auctionToAdd.PhoneNumber = newAuction.PhoneNumber;
            auctionToAdd.PhotosPath  = ConvertedPaths;
            auctionToAdd.Category    = _context.AuctionCategories.FirstOrDefault(x => x.Id == newAuction.CategoryId);
            auctionToAdd.User        = newAuction.User;


            _context.Auctions.Add(auctionToAdd);
            _context.SaveChanges();
        }
        public List <AuctionPhoto> GetPhotos(MySqlConnection connection)
        {
            MySqlCommand        command = new MySqlCommand(SQL_GET_PHOTOS, connection);
            List <AuctionPhoto> photos  = new List <AuctionPhoto>();

            using (MySqlDataReader mySqlDataReader = command.ExecuteReader())
            {
                while (mySqlDataReader.Read())
                {
                    AuctionPhoto photo = new AuctionPhoto();

                    photo.FidCar   = mySqlDataReader.GetInt32(0);
                    photo.PachPoto = mySqlDataReader.GetString(1);
                    photo.Id       = mySqlDataReader.GetInt32(2);

                    photos.Add(photo);
                }
            }

            return(photos);
        }