PersonelEkle Controller
|
1 2 3 4 5 |
[HttpPost] public ActionResult PersonelEkle(Personel model) { return View(); } |
PersonelEkle View
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
@using dataTableMVC.class_ @model Personel @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>PersonelEkle</title> </head> <body> <h2>Personel Ekle</h2> @using (Html.BeginForm("PersonelEkle", "Home", FormMethod.Post)) { <label>Ad</label> <br /> @Html.TextBoxFor(x=>x.Ad) <br /> <label>Soyad</label> <br /> @Html.TextBoxFor(x => x.Soyad) <br /> <label>Kimlik No</label> <br /> @Html.TextBoxFor(x => x.KimlikNo) <br /> <label>MedeniDurum</label> <br /> @Html.DropDownListFor(x=>x.MedeniDurum,new List<SelectListItem> { new SelectListItem() {Text="Bekar",Value="0" }, new SelectListItem() {Text="Evli",Value="1" }, }) <br /> <label>Yas</label> <br /> @Html.TextBoxFor(x => x.Yas) <br /> <label>Il</label> <br /> @Html.TextBoxFor(x => x.Il) <br /> <label>Ilce</label> <br /> @Html.TextBoxFor(x => x.Ilce) <br /><br /> <input type="submit" name="Kaydet"/> } </body> </html> |
Personel Class
|
1 2 3 4 5 6 7 8 9 10 11 |
public class Personel { public int Id { get; set; } public string Ad { get; set; } public string Soyad { get; set; } public int KimlikNo { get; set; } public string MedeniDurum { get; set; } public string Il { get; set; } public string Ilce { get; set; } public int Yas { get; set; } } |

Gönder butonuna bastığımız zaman PersonelEkle ActionResultına verileri POST ediyor.
