public async Task <IActionResult> Edit(int id, [Bind("VillageId,VillageName,District")] VillageDetails villageDetails)
        {
            if (id != villageDetails.VillageId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(villageDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VillageDetailsExists(villageDetails.VillageId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(villageDetails));
        }
        /// <summary>
        /// Asks user input for villageDetails
        /// </summary>
        /// <param name="roomType">type of room to give details for</param>
        /// <param name="id">village id</param>
        /// <returns>Village Details POCO</returns>
        private static VillageDetails GetDetails(int roomType, int id)
        {
            Console.WriteLine("Please enter the following details for the rooms of type \"" + ClubMedDBAccess.GetRoomType(roomType) + "\"");
            int rooms = InputInt("Please enter number of rooms");
            int price = InputInt("Please enter price of room (per week)");

            VillageDetails details = new VillageDetails(id, roomType, rooms, price);

            return(details);
        }
        public async Task <IActionResult> Create([Bind("VillageId,VillageName,District")] VillageDetails villageDetails)
        {
            if (ModelState.IsValid)
            {
                _context.Add(villageDetails);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(villageDetails));
        }
        // GET: DoctorsDetails
        public async Task <IActionResult> Index()
        {
            var doctors = await _context.doctors.ToListAsync();

            List <Doctor> alldoctors = new List <Doctor>();

            foreach (var doctor in doctors)
            {
                VillageDetails village = _context.VillageDetails.FirstOrDefault(v => v.VillageId == doctor.VillageId);
                doctor.villageDetails = village;
                alldoctors.Add(doctor);
            }
            return(View(alldoctors));
        }
        /// <summary>
        /// This is once again pretty self explanatory
        /// </summary>
        private static void InsertVillageInput()
        {
            bool wrong = true;

            while (wrong)
            {
                try
                {
                    int villageID = InputInt("Please enter the Village's ID");

                    string villageName = InputString("Please enter the villages name.");
                    string country     = InputString("Enter the villages country").ToLower();
                    string city        = InputString("Enter the villages city");
                    string street      = InputString("Enter the villages street");
                    int    houseNumber = InputInt("Enter the house number");
                    Console.WriteLine(ClubMedDBAccess.GetActivities());
                    int mainActivityID = InputInt("Enter the villages main activity");
                    int startingTime   = InputInt("Enter Starting Time");
                    if (startingTime < 1 || startingTime > 51)
                    {
                        throw new InvalidTimeExeption();
                    }
                    int endingTime = InputInt("Enter Ending Time");
                    if ((endingTime > 52 || endingTime < 2) || endingTime < startingTime)
                    {
                        throw new InvalidTimeExeption();
                    }
                    double rating = InputDouble("Enter Village Rating");
                    if (rating > 5 || rating < 1)
                    {
                        throw new InvalidRatingExeption();
                    }
                    wrong = false;

                    VillageDetails[] details = new VillageDetails[3];

                    for (int i = 1; i <= 3; i++)
                    {
                        details[i - 1] = GetDetails(i, villageID);
                    }

                    ClubMedDBAccess.InsertVillage(new Village(villageID,
                                                              villageName,
                                                              country,
                                                              city,
                                                              street,
                                                              houseNumber,
                                                              mainActivityID,
                                                              startingTime,
                                                              endingTime,
                                                              rating),

                                                  details);


                    DanHelper.Say("k1far1chahit1vasef1behats1lacha");
                    Console.WriteLine("Village Added Successfully");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }