public JsonResult Create(Student_PelkaMODEL student)
        {
            //if (ModelState.IsValid)
            // {
            var model = new Student_Pelka();

            model.Adresa         = student.Adresa;
            model.Datum_rodjenja = DateTime.ParseExact(student.Datum_rodjenja, "MM/dd/yyyy", CultureInfo.InvariantCulture);
            model.Ime            = student.Ime;
            model.Prezime        = student.Prezime;
            model.Telefon        = student.Telefon;
            model.ID_studenta    = student.ID_studenta;

            db.Student_Pelka.Add(model);
            db.SaveChanges();
            return(Json("OK"));
        }
Esempio n. 2
0
        public ActionResult Delete(Student_Dragana delete)
        {
            using (var db = new Praksa_Nov_2019Entities())
            {
                var studentDelete = db.Student_Dragana.Where(s => s.ID == delete.ID).FirstOrDefault();
                db.Student_Dragana.Remove(studentDelete);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
        }
Esempio n. 3
0
        public ActionResult Edit(Student_Dragana edit)
        {
            using (var db = new Praksa_Nov_2019Entities())
            {
                var studentEdit = db.Student_Dragana.Where(s => s.ID == edit.ID).FirstOrDefault();

                studentEdit.ID            = edit.ID;
                studentEdit.Ime           = edit.Ime;
                studentEdit.Prezime       = edit.Prezime;
                studentEdit.Adresa        = edit.Adresa;
                studentEdit.Telefon       = edit.Telefon;
                studentEdit.DatumRodjenja = edit.DatumRodjenja;

                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
        }
Esempio n. 4
0
        public ActionResult Create(Student_Dragana create)
        {
            using (var db = new Praksa_Nov_2019Entities())

            {
                var studentCreate = new Student_Dragana();

                studentCreate.ID            = Guid.NewGuid();
                studentCreate.Ime           = create.Ime;
                studentCreate.Prezime       = create.Prezime;
                studentCreate.Adresa        = create.Adresa;
                studentCreate.Telefon       = create.Telefon;
                studentCreate.DatumRodjenja = create.DatumRodjenja;

                db.Student_Dragana.Add(studentCreate);


                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
        }