Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- namespace plan_1.Models
- {
- public class Airport: BaseEntity
- {
- public int Id { get; set; }
- public string Iata { get; set; }
- public string Icao { get; set; }
- public string LogoUrl { get; set; }
- public int IsBased { get; set; }
- public int CityId { get; set; }
- public virtual City City { get; set; }
- public Airport()
- {
- this.Terminals = new
- HashSet<Terminal>();
- }
- public ICollection<Terminal> Terminals
- { get; set; }
- }
- }
- enter code here
- using System.Linq;
- using Microsoft.AspNetCore.Mvc;
- using plan_1.Models;
- namespace plan_1.Controllers
- {
- public class planController : Controller
- {
- public ActionResult Index()
- {
- return View();
- }
- public JsonResult GetAirPort()
- {
- plan_1Context dbContext = new
- plan_1Context();
- return
- Json(dbContext.AirPorts.Select(O =>
- new { _Id = O.Id, Origin = O.Iata
- }),
- JsonRequestBehavior.AllowGet);
- }
- }
- }
- @model IEnumerable<plan_1.Models.Airport>
- @{
- ViewData["Title"] = "Planing";
- }
- <div>
- <h4>Origin:</h4>
- @(Html.Kendo().DropDownList()
- .Name("Origin")
- .HtmlAttributes(new { style
- = "width:100%" })
- .OptionLabel("Select
- category...")
- .DataTextField("Iata")
- .DataValueField("Id")
- .DataSource(source =>
- {
- source.Read(read =>
- {
- read.Action("GetAirPorts",
- "planController");
- });
- })
- )
- </div>
- also, I should mix the airplane model by
- the plan model, I think I should use the
- view model to mix them.
- Please help what should I do? It is days
- that I am looking for the answer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement