コード例 #1
0
 public ActionResult Create()
 {
     ViewBag.FromCity = new SelectList(cityMgr.GetCity(), "CityId", "CityName");
     ViewBag.ToCity   = new SelectList(cityMgr.GetCity(), "CityId", "CityName");
     ViewBag.Flight   = new SelectList(flightMgr.GetFlight(), " FlightID", "Name");
     ViewBag.Airline  = new SelectList(airlineMgr.GetAirline(), "AirlineId", "AirlineName");
     return(View());
 }
コード例 #2
0
        /// <summary>
        /// Action To Create Hotel
        /// </summary>
        /// <returns></returns>
        public ActionResult CreateHotel()
        {
            var option = from n in cityManager.GetCity()
                         select new SelectListItem {
                Text = n.CityName, Value = n.CityId.ToString()
            };

            ViewBag.CityID = option;
            return(View());
        }
コード例 #3
0
 /// <summary>
 /// Index To Search Hotel
 /// </summary>
 /// <returns></returns>
 public ActionResult Index()
 {
     try
     {
         var option = from n in cityManager.GetCity().OrderBy(x => x.CityName)
                      select new SelectListItem {
             Text = n.CityName, Value = n.CityId.ToString()
         };
         ViewBag.CityId = option;
         //ViewBag.CityId = cityManager.GetCity();
         List <int> noofperson = null;
         noofperson = new List <int> {
             1, 2, 3, 4, 5, 6
         };
         var person = from m in noofperson
                      select new SelectListItem {
             Text = m.ToString(), Value = m.ToString()
         };
         ViewBag.NoOfPeople = person;
         List <int> noofroom = null;
         noofroom = new List <int> {
             1, 2, 3, 4, 5, 6
         };
         var room = from p in noofroom
                    select new SelectListItem {
             Text = p.ToString(), Value = p.ToString()
         };
         ViewBag.NoOfRooms = room;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(View());
 }
コード例 #4
0
        public IHttpActionResult GetCity(long cityid)
        {
            CityViewModel city = _cityManager.GetCity(cityid);

            if (city == null)
            {
                return(NotFound());
            }
            return(Ok(city));
        }
コード例 #5
0
        /// <summary>
        /// Index action of City Controller
        /// Returns a list of Cities to the view
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult Index(int?page)
        {
            List <City> cities = cityMgr.GetCity().ToList <City>();

            return(View(cities.ToPagedList((page ?? 1), 8)));
        }
コード例 #6
0
        public ActionResult GetCity(int id)
        {
            CityViewModel city = _cityManager.GetCity(id);

            return(Json(city, JsonRequestBehavior.AllowGet));
        }