public IHttpActionResult DeleteRace(int?id)
        {
            if (!id.HasValue)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            var raceDB = raceRepository.GetRace(id ?? (int)InvalidPropertyValues.undefinedValue);

            if (raceDB == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            var tickets = ticketRepository.GetTicketsByRace(raceDB.RaceID);

            if (tickets.Any())
            {
                return(BadRequest("The Race is used in a Ticket!\nTo delete it contact your Database Manager."));
            }

            foreach (var item in raceDB.Assets)
            {
                fileManager.DeleteFile(item);
                filePathRepository.RemoveFilepath(item.FilePath);
            }

            fileManager.DeleteFolders(ModelType.Race, raceDB.RaceID.ToString());

            raceRepository.Remove(raceDB);
            unitOfWork.Complete();

            return(Ok());
        }
        //Get
        public ActionResult Manipulate(int?id)
        {
            var fileManager = new FileManager(Server);

            if (!id.HasValue)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var planets = planetRepository.GetPlanetsRaw();
            var raceClassificationList = raceClassificationRepository.GetRaceClassifications();

            if (id.Value == 0)
            {
                var viewModel = RaceFormViewModel.RaceFormViewModelCreationNew(planets, raceClassificationList, fileManager);

                return(View(viewModel));
            }
            else
            {
                var race = raceRepository.GetRace(id.Value);

                var viewModel = RaceFormViewModel.RaceFormViewModelEdit(race, planets, raceClassificationList, fileManager);

                return(View(viewModel));
            }
        }
        public ActionResult <Race> GetRace(int id)
        {
            var race = _raceRepository.GetRace(id);

            if (race == null)
            {
                return(NotFound($"Race id {id}"));
            }

            return(race);
        }
        public ActionResult Race(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var fileManager = new FileManager(Server);

            var race = raceRepository.GetRace(id.Value);

            var viewModel = new UserRaceViewModel(race, fileManager);

            return(View("Race", viewModel));
        }