Guest User

Untitled

a guest
Jul 17th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. public class Project
  2. {
  3. public Project()
  4. {
  5. CategoryId = 0;
  6. Name = "";
  7. Description = "";
  8. //Categories = new Dictionary<int, string>();
  9.  
  10. Entities _db = new Entities(); //ef4
  11. CateogoriesList = from c in _db.Categories
  12. orderby c.Name
  13. select c.Name;
  14. }
  15.  
  16. public int CategoryId { get; set; }
  17.  
  18. [Required]
  19. [DataType(DataType.Text)]
  20. [Display(Name = "Project Name")]
  21. public string Name { get; set; }
  22.  
  23. [Required]
  24. [DataType(DataType.MultilineText)]
  25. [Display(Name = "Project Description")]
  26. public string Description { get; set; }
  27.  
  28. public IQueryable<string> CateogoriesList;
  29.  
  30. }
  31.  
  32. public ActionResult Create()
  33. {
  34. Models.Project.Project proj = new Models.Project.Project();
  35. return View(proj);
  36. }
  37.  
  38. @{
  39. ViewBag.Title = "Create";
  40. Layout = "~/Views/Shared/_Layout.cshtml";
  41. }
  42.  
  43. @model Models.Project.Project
  44.  
  45.  
  46. @using (Html.BeginForm())
  47. {
  48. @Html.ValidationSummary(true);
  49.  
  50. <fieldset>
  51. <legend>Submit Your Request</legend>
  52. <div class="editor-label">@Html.LabelFor( Model => Model.CateogoriesList )</div>
  53. <div class="editor-field">
  54. @Html.DropDownList("Category", new SelectList( Model.CateogoriesList ) )
  55. </div>
  56. </fieldset>
  57. <p><input type="submit" value="Send for RFP" /></p>
  58. }
  59.  
  60. Riebro.RiebroEntities _db = new Riebro.RiebroEntities();
  61. CategoriesList = (from c in _db.Categories
  62. orderby c.Name
  63. select c.Name).ToArray<string>();
  64. }
  65.  
  66.  
  67. [Display(Name = "Choose a category")]
  68. public string[] CategoriesList;
  69.  
  70. @Html.DropDownList("Category", new SelectList(Model.CategoriesList))
  71.  
  72. <div class="editor-label">@Html.LabelFor( Model => Model.CateogoriesList )</div>
  73.  
  74. <div class="editor-label">@Html.LabelFor( Model => Model.CategoryId )</div>
  75.  
  76. @using (Html.BeginForm())
  77. {
  78. @Html.ValidationSummary(true);
  79.  
  80. <fieldset>
  81. <legend>Submit Your Request</legend>
  82. <div class="editor-label">@Html.LabelFor(x=>x.CategoryId )</div>
  83. <div class="editor-field">
  84. @Html.DropDownList("Category", new SelectList(Model.CateogoriesList) )
  85. </div>
  86. </fieldset>
  87. <p><input type="submit" value="Send for RFP" /></p>
  88. }
  89.  
  90. public class Project {
  91. public Project() {
  92. CategoryId = 0;
  93. Name = "";
  94. Description = "";
  95. //Categories = new Dictionary<int, string>();
  96.  
  97. //Entities _db = new Entities(); //ef4
  98. //CateogoriesList = from c in _db.Categories
  99. // orderby c.Name
  100. // select c.Name;
  101. //IQueryable<string> categoriesList = (new string[] { }).AsQueryable();
  102. CateogoriesList = new string[] { "abc", "def", "hij", "klm" };
  103. CategoriesList2 = (new string[] { "abc", "def", "hij", "klm" }).AsQueryable();
  104. }
  105.  
  106. public int CategoryId { get; set; }
  107.  
  108. [Required]
  109. [DataType(DataType.Text)]
  110. [Display(Name = "Project Name")]
  111. public string Name { get; set; }
  112.  
  113. [Required]
  114. [DataType(DataType.MultilineText)]
  115. [Display(Name = "Project Description")]
  116. public string Description { get; set; }
  117.  
  118. public string[] CateogoriesList;
  119.  
  120. public IQueryable<string> CategoriesList2;
  121.  
  122. }
  123.  
  124. @model MvcApplication3.Models.Project
  125.  
  126.  
  127. @using (Html.BeginForm())
  128. {
  129. @Html.ValidationSummary(true);
  130.  
  131. <fieldset>
  132. <legend>Submit Your Request</legend>
  133. <div class="editor-label">@Html.LabelFor(x=>x.CategoryId )</div>
  134. <div class="editor-field">
  135. @Html.DropDownList("Category", new SelectList(Model.CategoriesList2) )
  136. </div>
  137. </fieldset>
  138. <p><input type="submit" value="Send for RFP" /></p>
  139. }
  140.  
  141. @model Models.Project.Project
  142.  
  143. public ActionResult Create()
  144. {
  145. Riebro.Models.Project.Project proj = new Riebro.Models.Project.Project();
  146. return View(proj);
  147. }
  148.  
  149. @Html.LabelFor(Model => Model.CateogoriesList)
  150.  
  151. <div class="editor-label">@Html.LabelFor( Model => Model.CateogoriesList )</div>
  152.  
  153. <div class="editor-label">@Html.LabelFor( m=> m.CateogoriesList )</div>
Add Comment
Please, Sign In to add comment