public async Task AddCity(City city)
 {
     var item = Cities.FirstOrDefault(x => x.Name.Equals(city.Name));
     if (item != null)
     {
         Cities.Add(city);
         await SaveChangesAsync();
     }
 }
        // GET: /WeatherForecast/Index
        public async Task<ActionResult> AddToFavorite(City city)
        {
            using (context = new FavoriteCityContext())
            {
                if (!context.CheckCity(city))
                {
                    await context.AddCity(city);
                }
                else
                {
                    return View("ErrorRequest",
                        new RootObject {Cod = 409, ErrorMessage = "A city with the same name already exists!"});
                }
            }

            return Redirect("/WeatherForecast/Index");
        }
 public bool CheckCity(City city)
 {
     return Cities.Any(x => x.Name.Equals(city.Name));
 }