Ejemplo n.º 1
0
        public ActionResult New(New_specializare_and_new_Domenii specializare)
        {
            specializare.Dom.Programe = GetAllPrograms();


            var spec = from spc in db.Domenii select spc;

            spec = spec.OrderBy(s => s.Program_de_studiuId);

            var selectList = new List <Domeniu>();

            foreach (var p in spec)
            {
                selectList.Add(p);
            }
            specializare.AllDomenii = selectList;

            if (ModelState.IsValid)
            {
                db.Domenii.Add(specializare.Dom);
                specializare.Dom.Programe = GetAllPrograms();
                db.SaveChanges();
                TempData["message"] = "Specializarea a fost adaugata!";
                return(RedirectToAction("New"));
            }
            else
            {
                return(View(specializare));
            }
        }
Ejemplo n.º 2
0
        public ActionResult New()
        {
            New_specializare_and_new_Domenii sp = new New_specializare_and_new_Domenii();

            sp.Dom = new Domeniu();

            sp.Dom.Programe = GetAllPrograms();


            var spec = from spc in db.Domenii select spc;

            spec = spec.OrderBy(s => s.Program_de_studiuId);

            var selectList = new List <Domeniu>();

            foreach (var p in spec)
            {
                selectList.Add(p);
            }
            sp.AllDomenii = selectList;



            return(View(sp));
        }