Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.2 kB
1
Indexable
Never
using BaşvuruFormu.Database;
using BaşvuruFormu.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;

namespace BaşvuruFormu.Controllers
{
    public class HomeController : Controller
    {
        
        private Data_Context db = new Data_Context();
        public ActionResult Index()
        {
            return View();
        }


        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Index([Bind(Include =  "Id,AdSoyad,FakulteAdi,Bolumu,TelefonNo,OgrenciNo,KimlikNo,Ikametgah")] OgrenciBilgileri ogrenci)
        {
            if (ModelState.IsValid)
            {
                db.Ogrenci.Add(ogrenci);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(ogrenci);
        }

        //[HttpPost]
        //public ActionResult Index(TickBox model)
        //{
        //    if (model.IsChecked1)
        //    {
        //        ViewBag.Message = "Onay kutusu işaretlendi!";
        //    }
        //    else
        //    {
        //        ViewBag.Message = "Onay kutusu işareti kaldırıldı!";
        //    }

        //    return View(model);
        //}
    }
}
Leave a Comment