SHARE
TWEET

Untitled

a guest Feb 21st, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading.Tasks;
  4.  
  5. namespace plan_1.Models
  6. {
  7. public class Airport: BaseEntity  
  8.    {
  9.     public int Id { get; set; }
  10.     public string Iata { get; set; }
  11.     public string Icao { get; set; }
  12.     public string LogoUrl { get; set; }
  13.     public int IsBased { get; set; }
  14.     public int CityId { get; set; }
  15.     public virtual City City { get; set; }
  16.  
  17.     public Airport()
  18.     {
  19.         this.Terminals = new
  20.           HashSet<Terminal>();
  21.     }
  22.      public ICollection<Terminal> Terminals
  23.      { get; set; }
  24.    }
  25. }
  26.      
  27. enter code here
  28.  
  29. using System.Linq;
  30. using Microsoft.AspNetCore.Mvc;
  31. using plan_1.Models;
  32. namespace plan_1.Controllers
  33. {
  34.  public class planController : Controller
  35.  {        
  36.     public ActionResult Index()
  37.     {
  38.         return View();
  39.     }
  40.     public JsonResult GetAirPort()
  41.     {
  42.       plan_1Context dbContext = new
  43.       plan_1Context();
  44.  
  45.         return
  46.         Json(dbContext.AirPorts.Select(O =>
  47.         new { _Id = O.Id, Origin = O.Iata
  48.         }),
  49.      JsonRequestBehavior.AllowGet);
  50.     }
  51.   }
  52. }
  53.      
  54. @model IEnumerable<plan_1.Models.Airport>
  55. @{
  56.  ViewData["Title"] = "Planing";
  57.  }
  58.  
  59.  <div>
  60.  
  61.     <h4>Origin:</h4>
  62.  
  63.  
  64.     @(Html.Kendo().DropDownList()
  65.                 .Name("Origin")
  66.                 .HtmlAttributes(new { style
  67.     = "width:100%" })
  68.                 .OptionLabel("Select
  69.      category...")
  70.                 .DataTextField("Iata")
  71.                 .DataValueField("Id")
  72.                 .DataSource(source =>
  73.                 {
  74.                     source.Read(read =>
  75.                     {                  
  76. read.Action("GetAirPorts",
  77.        "planController");
  78.                     });
  79.                 })
  80.  
  81.     )
  82. </div>
  83.  
  84.  
  85. also, I should mix the airplane model by
  86. the plan model, I think I should use the
  87. view model to mix them.
  88.  
  89. Please help what should I do? It is days
  90. that I am looking for the answer
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top