Advertisement
Guest User

Untitled

a guest
Mar 16th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.83 KB | None | 0 0
  1. <div class="container-fluid">
  2. <div class="row">
  3.  
  4. <div class="jumbotron jumbotron-fluid">
  5. <div class="container">
  6. <h1 class="display-4">ÖĞRENCİ DÜZENLEME SAYFASI</h1>
  7. <p class="lead">Bu ekrandan öğrenci bilgilerini düzenleyebilirsiniz.</p>
  8. </div>
  9. </div>
  10.  
  11. <div class="btn btn-light">
  12. @Html.ActionLink(" Öğrenci Listesine Geri Dön", "Index", null, new { @class = "btn btn-warning fa fa-list" })
  13. </div>
  14.  
  15. @using (Html.BeginForm("Edit", "Student", FormMethod.Post, new { enctype = "multipart/form-data" }))
  16. {
  17. @Html.AntiForgeryToken()
  18. @Html.ValidationSummary(true, "", new { @class = "text-danger" })
  19. @Html.HiddenFor(model => model.Id)
  20. <hr />
  21. <div class="col-md-5">
  22. <div class="form-group">
  23. <label>ALAN</label>
  24. <div class="input-group">
  25. <span class="input-group-addon"><i class="fa fa-graduation-cap"></i></span>
  26. @Html.EditorFor(model => model.Type, new { htmlAttributes = new { @class = "form-control" } })
  27. </div>
  28. <small class="form-text text-muted">Öğrenci Alanını Giriniz. Örneğin; Sayısal, Sözel</small>
  29. @Html.ValidationMessageFor(model => model.Type, "", new { @class = "text-danger" })
  30. </div>
  31.  
  32. <div class="form-group">
  33. <label>SINIF</label>
  34. <div class="input-group">
  35. <span class="input-group-addon"><i class="fa fa-users"></i></span>
  36. @Html.DropDownList("Class_Id", null, htmlAttributes: new { @class = "form-control" })
  37. </div>
  38. <small class="form-text text-muted">Öğrenci Sınıfını Seçiniz</small>
  39. @Html.ValidationMessageFor(model => model.Class_Id, "", new { @class = "text-danger" })
  40. </div>
  41.  
  42. <div class="form-group">
  43. <label>GRUP</label>
  44. <div class="input-group">
  45. <span class="input-group-addon"><i class="fa fa-indent"></i></span>
  46. @Html.DropDownList("Group_Id", null, htmlAttributes: new { @class = "form-control" })
  47. </div>
  48. <small class="form-text text-muted">Öğrenci hazırlandığı sınav türünü seçiniz</small>
  49. @Html.ValidationMessageFor(model => model.Group_Id, "", new { @class = "text-danger" })
  50. </div>
  51.  
  52. <div class="form-group">
  53. <label>TC NUMARASI</label>
  54. <div class="input-group">
  55. <span class="input-group-addon"><i class="fa fa-id-card-o"></i></span>
  56. @Html.EditorFor(model => model.TCno, new { htmlAttributes = new { @class = "form-control" } })
  57. </div>
  58. <small class="form-text text-muted">Öğrenci TC Kimlik numarası giriniz</small>
  59. @Html.ValidationMessageFor(model => model.TCno, "", new { @class = "text-danger" })
  60. </div>
  61.  
  62. <div class="form-group">
  63. <label>AD</label>
  64. <div class="input-group">
  65. <span class="input-group-addon"><i class="fa fa-font"></i></span>
  66. @Html.EditorFor(model => model.FName, new { htmlAttributes = new { @class = "form-control" } })
  67. </div>
  68. <small class="form-text text-muted">Öğrenci Ad</small>
  69. @Html.ValidationMessageFor(model => model.FName, "", new { @class = "text-danger" })
  70. </div>
  71.  
  72.  
  73.  
  74. <div class="form-group">
  75. <label>SOYAD</label>
  76. <div class="input-group">
  77. <span class="input-group-addon"><i class="fa fa-strikethrough"></i></span>
  78. @Html.EditorFor(model => model.LName, new { htmlAttributes = new { @class = "form-control" } })
  79. </div>
  80. <small class="form-text text-muted">Öğrenci Soyadı Giriniz</small>
  81. @Html.ValidationMessageFor(model => model.LName, "", new { @class = "text-danger" })
  82. </div>
  83.  
  84. <div class="form-group">
  85. <label>CİNSİYET</label>
  86. <div class="input-group">
  87. <span class="input-group-addon"><i class="fa fa-intersex"></i></span>
  88. <table>
  89. <tr>
  90. <td>@Html.RadioButtonFor(model => model.Gender, true) <strong>Bay</strong></td>
  91. <td> &nbsp; &nbsp;&nbsp; </td>
  92. <td>@Html.RadioButtonFor(model => model.Gender, false) <strong>Bayan</strong></td>
  93. </tr>
  94. </table>
  95. </div>
  96. <small class="form-text text-muted">Öğrenci Cinsiyeti seçiniz</small>
  97. @Html.ValidationMessageFor(model => model.Gender, "", new { @class = "text-danger" })
  98. </div>
  99.  
  100. <div class="form-group">
  101. <label>DOĞUM TARİHİ</label>
  102. <div class="input-group">
  103. <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
  104. @Html.EditorFor(model => model.Birthday, new { htmlAttributes = new { @class = "form-control" } })
  105. </div>
  106. <small class="form-text text-muted">Öğrenci Doğum Tarihi</small>
  107. @Html.ValidationMessageFor(model => model.Birthday, "", new { @class = "text-danger" })
  108. </div>
  109.  
  110. <div class="form-group">
  111. <label>ÖĞRENCİ TELEFON</label>
  112. <div class="input-group">
  113. <span class="input-group-addon"><i class="fa fa-phone"></i></span>
  114. @Html.EditorFor(model => model.Phone, new { htmlAttributes = new { @class = "form-control" } })
  115. </div>
  116. <small class="form-text text-muted">Öğrenci Mobil telefon numarası giriniz. Ör: 05xx xxx xxxx</small>
  117. @Html.ValidationMessageFor(model => model.Phone, "", new { @class = "text-danger" })
  118. </div>
  119.  
  120. <div class="form-group">
  121. <label>DURUM</label>
  122. <div class="input-group">
  123. <span class="input-group-addon"><i class="fa fa-toggle-on"></i></span>
  124. <table>
  125. <tr>
  126. <td>@Html.RadioButtonFor(model => model.Status, true) <strong>Aktif</strong></td>
  127. <td> &nbsp; &nbsp;&nbsp; </td>
  128. <td>@Html.RadioButtonFor(model => model.Status, false) <strong>Pasif</strong></td>
  129. </tr>
  130. </table>
  131. </div>
  132. <small class="form-text text-muted">Öğrenci Durumunu seçiniz</small>
  133. @Html.ValidationMessageFor(model => model.Status, "", new { @class = "text-danger" })
  134. </div>
  135.  
  136. <div class="form-group">
  137. <label>FOTOĞRAF</label>
  138. <div class="input-group">
  139. <img src="@Url.Content(Session["Image"].ToString())" height="100" width="100" />
  140. <br />
  141. <input type="file" class="custom-file-input" value="Dosya Seç..." name="ImageFile">
  142. </div>
  143. <small class="form-text text-muted">Öğrenci fotoğrafı seçiniz. 1 MB küçük |.png|.jpg|.jpeg uzantılı dosyayı seçiniz.</small>
  144. @Html.ValidationMessageFor(model => model.Photo, "", new { @class = "text-danger" })
  145. </div>
  146. </div>
  147.  
  148. <div class="col-md-1"></div>
  149.  
  150. <div class="col-md-5">
  151. <div class="form-group">
  152. <label>E-POSTA</label>
  153. <div class="input-group">
  154. <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
  155. @Html.EditorFor(model => model.eMail, new { htmlAttributes = new { @class = "form-control" } })
  156. </div>
  157. <small class="form-text text-muted">Öğrenci Sisteme giriş yapabilmesi için bir E-Posta adresi giriniz.</small>
  158. @Html.ValidationMessageFor(model => model.eMail, "", new { @class = "text-danger" })
  159. </div>
  160.  
  161. <div class="form-group">
  162. <label>ŞİFRE</label>
  163. <div class="input-group">
  164. <span class="input-group-addon"><i class="fa fa-key"></i></span>
  165. @Html.EditorFor(model => model.Password, new { htmlAttributes = new { @class = "form-control" } })
  166. </div>
  167. <small class="form-text text-muted">Öğrenci Sisteme giriş yapabilmesi için bir şifre giriniz.</small>
  168. @Html.ValidationMessageFor(model => model.Password, "", new { @class = "text-danger" })
  169. </div>
  170.  
  171.  
  172. <div class="form-group">
  173. <label>KATILMA TARİHİ</label>
  174. <div class="input-group">
  175. <span class="input-group-addon"><i class="fa fa-check-circle-o"></i></span>
  176. @Html.EditorFor(model => model.DateOfJoin, new { htmlAttributes = new { @class = "form-control" } })
  177. </div>
  178. <small class="form-text text-muted">Öğrenci Katılma tarihini giriniz.</small>
  179. @Html.ValidationMessageFor(model => model.DateOfJoin, "", new { @class = "text-danger" })
  180. </div>
  181.  
  182. <div class="form-group">
  183. <label>AYRILMA TARİHİ</label>
  184. <div class="input-group">
  185. <span class="input-group-addon"><i class="fa fa-circle-o"></i></span>
  186. @Html.EditorFor(model => model.DateOfLeave, new { htmlAttributes = new { @class = "form-control" } })
  187. </div>
  188. <small class="form-text text-muted">Öğrenci Ayrılma tarihini seçiniz.</small>
  189. </div>
  190.  
  191. <div class="form-group">
  192. <label>ADRES</label>
  193. <div class="input-group">
  194. <span class="input-group-addon"><i class="fa fa-map-marker"></i></span>
  195. @Html.TextAreaFor(model => model.Address, new { @class = "form-control", @style = "height: 100px" })
  196. </div>
  197. <small class="form-text text-muted">Öğrenci Adres'ini giriniz.</small>
  198. @Html.ValidationMessageFor(model => model.Address, "", new { @class = "text-danger" })
  199. </div>
  200.  
  201. <div class="form-group">
  202. <label>VELİ AD</label>
  203. <div class="input-group">
  204. <span class="input-group-addon"><i class="fa fa-id-badge"></i></span>
  205. @Html.EditorFor(model => model.ParentName, new { htmlAttributes = new { @class = "form-control" } })
  206. </div>
  207. <small class="form-text text-muted">Öğrenci'nin Veli adını giriniz.</small>
  208. @Html.ValidationMessageFor(model => model.ParentName, "", new { @class = "text-danger" })
  209. </div>
  210.  
  211. <div class="form-group">
  212. <label>VELİ TELEFON 1</label>
  213. <div class="input-group">
  214. <span class="input-group-addon"><i class="fa fa-mobile"></i></span>
  215. @Html.EditorFor(model => model.ParentPhone1, new { htmlAttributes = new { @class = "form-control" } })
  216. </div>
  217. <small class="form-text text-muted">Öğrenci'nin Veli Telefon numarasını giriniz.</small>
  218. @Html.ValidationMessageFor(model => model.ParentPhone1, "", new { @class = "text-danger" })
  219. </div>
  220.  
  221. <div class="form-group">
  222. <label>VELİ TELEFON 2</label>
  223. <div class="input-group">
  224. <span class="input-group-addon"><i class="fa fa-phone"></i></span>
  225. @Html.EditorFor(model => model.ParentPhone2, new { htmlAttributes = new { @class = "form-control" } })
  226. </div>
  227. <small class="form-text text-muted">Öğrenci'nin Veli yedek telefon numarasını giriniz.</small>
  228. </div>
  229.  
  230. <div class="form-group">
  231. <label>VELİ CİNSİYET</label>
  232. <div class="input-group">
  233. <span class="input-group-addon"><i class="fa fa-intersex"></i></span>
  234. <table>
  235. <tr>
  236. <td>@Html.RadioButtonFor(model => model.ParentGender, true) <strong>Bay</strong></td>
  237. <td> &nbsp; &nbsp;&nbsp; </td>
  238. <td>@Html.RadioButtonFor(model => model.ParentGender, false) <strong>Bayan</strong></td>
  239. </tr>
  240. </table>
  241. </div>
  242. <small class="form-text text-muted">Veli'nin cinsiyetini seçiniz.</small>
  243. @Html.ValidationMessageFor(model => model.ParentGender, "", new { @class = "text-danger" })
  244. </div>
  245.  
  246. <div class="form-group">
  247. <label>AÇIKLAMA</label>
  248. <div class="input-group">
  249. <span class="input-group-addon"><i class="fa fa-align-justify"></i></span>
  250. @Html.TextAreaFor(model => model.Description, new { @class = "form-control", @style = "height: 100px" })
  251. </div>
  252. <small class="form-text text-muted">Öğrenci için bir açıklama giriniz.</small>
  253. @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
  254. </div>
  255. </div>
  256.  
  257. <div class="col-md-1"></div>
  258. <br />
  259. <br />
  260. <div class="form-group">
  261. <div class="col-md-12">
  262. <button type="submit" class="btn btn-success ">
  263. <i class="fa fa-floppy-o">&nbsp; &nbsp;Değişiklikleri Kaydet</i>
  264. </button>
  265. </div>
  266. </div>
  267. <br />
  268. <br />
  269. }
  270. </div>
  271.  
  272. private DBClassroomEntities db = new DBClassroomEntities();
  273. / GET: Student/Edit/5
  274. public ActionResult Edit(int? id)
  275. {
  276. if (id == null)
  277. {
  278. return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
  279. }
  280. var student = db.Students.Find(id);
  281. if (student == null)
  282. {
  283. return HttpNotFound();
  284. }
  285. ViewBag.Class_Id = new SelectList(db.Classes, "ID", "Name", student.Class_Id);
  286. ViewBag.Group_Id = new SelectList(db.Groups, "ID", "Name", student.Group_Id);
  287. return View(student);
  288. }
  289.  
  290. [HttpPost]
  291. [ValidateAntiForgeryToken]
  292. public ActionResult Edit(Student student)
  293. { //does not enter here because I can't see the old data in Student.
  294. if (ModelState.IsValid)
  295. {
  296. db.Entry(student).State = EntityState.Modified;
  297. db.SaveChanges();
  298. return RedirectToAction("Index");
  299. }
  300. ViewBag.Class_Id = new SelectList(db.Classes, "ID", "Name", student.Class_Id);
  301. ViewBag.Group_Id = new SelectList(db.Groups, "ID", "Name", student.Group_Id);
  302. return View(student);
  303. }
  304.  
  305. public partial class Student
  306. {
  307. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
  308. public Student()
  309. {
  310. this.Discontinuities = new HashSet<Discontinuity>();
  311. this.Grades = new HashSet<Grade>();
  312. this.Payments = new HashSet<Payment>();
  313. }
  314.  
  315. public int Id { get; set; }
  316. public string Type { get; set; }
  317. public Nullable<int> Class_Id { get; set; }
  318. public Nullable<int> Group_Id { get; set; }
  319. public string TCno { get; set; }
  320. public string FName { get; set; }
  321. public string LName { get; set; }
  322. public bool Gender { get; set; }
  323. public Nullable<System.DateTime> Birthday { get; set; }
  324. public string Phone { get; set; }
  325. public string eMail { get; set; }
  326. public string Password { get; set; }
  327. public bool Status { get; set; }
  328. public Nullable<System.DateTime> DateOfJoin { get; set; }
  329. public Nullable<System.DateTime> DateOfLeave { get; set; }
  330. public string Address { get; set; }
  331. public string ParentName { get; set; }
  332. public string ParentPhone1 { get; set; }
  333. public string ParentPhone2 { get; set; }
  334. public bool ParentGender { get; set; }
  335. public string Photo { get; set; }
  336. public string Description { get; set; }
  337.  
  338. //public HttpPostedFileBase filex { get; set; }
  339.  
  340. public virtual Class Class { get; set; }
  341. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
  342. public virtual ICollection<Discontinuity> Discontinuities { get; set; }
  343. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
  344. public virtual ICollection<Grade> Grades { get; set; }
  345. public virtual Group Group { get; set; }
  346. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
  347. public virtual ICollection<Payment> Payments { get; set; }
  348. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement