Beispiel #1
0
        public ActionResult Edit(int id, Bursa requestBursa)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Bursa bursa = db.Burse.Find(id);

                    if (TryUpdateModel(bursa))
                    {
                        bursa.Nume        = requestBursa.Nume;
                        bursa.Cuantum     = requestBursa.Cuantum;
                        bursa.MedieMinima = requestBursa.MedieMinima;
                        db.SaveChanges();
                        TempData["message"] = "Bursa a fost modificata!";
                    }
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception e)
            {
                return(View());
            }
        }
Beispiel #2
0
        public ActionResult Edit(int id)
        {
            Bursa bursa = db.Burse.Find(id);

            ViewBag.Bursa = bursa;

            return(View(bursa));
        }
Beispiel #3
0
        public ActionResult Delete(int id)
        {
            Bursa bursa = db.Burse.Find(id);

            db.Burse.Remove(bursa);
            db.SaveChanges();
            TempData["message"] = "Bursa a fost stersa!";
            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        public ActionResult Show(int id)
        {
            Bursa bursa = db.Burse.Find(id);

            ViewBag.Bursa          = bursa;
            ViewBag.afisareButoane = false;
            if (User.IsInRole("Secretar") || User.IsInRole("Administrator"))
            {
                ViewBag.afisareButoane = true;
            }
            ViewBag.esteAdmin = User.IsInRole("Administrator");
            return(View(bursa));
        }
Beispiel #5
0
 public ActionResult New(Bursa bursa)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Burse.Add(bursa);
             db.SaveChanges();
             TempData["message"] = "Bursa a fost adaugata!";
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(bursa));
         }
     }
     catch (Exception e)
     {
         return(View(bursa));
     }
 }
Beispiel #6
0
        // GET: Buget
        public ActionResult Index()
        {
            var specializari = db.Specializari.ToList();
            Dictionary <Specializare_pe_Domeniu, List <Tuple <Student, Bursa> > > bigList = new Dictionary <Specializare_pe_Domeniu, List <Tuple <Student, Bursa> > >();

            foreach (Specializare_pe_Domeniu specializare in specializari)
            {
                bigList.Add(specializare, new List <Tuple <Student, Bursa> >());
                var studIdList = db.Studenti.Where(x => x.SubramuraSpecializareId == specializare.SubramuraSpecializareId)
                                 .Select(x => x.StudentId).ToList();
                var studburs = db.StudentBurse.Where(x => studIdList.Contains(x.StudentId)).ToList();
                foreach (StudentBursa sb in studburs)
                {
                    Student student = db.Studenti.Find(sb.StudentId);
                    Bursa   bursa   = db.Burse.Find(sb.BursaId);
                    Tuple <Student, Bursa> tuple = new Tuple <Student, Bursa>(student, bursa);
                    bigList[specializare].Add(tuple);
                }
                bigList[specializare].OrderByDescending(x => x.Item1.MedieAnAnterior_Admitere);
            }
            return(View(bigList));
        }
        public ActionResult Show(int id)
        {
            Cerere cerere = db.Cereri.Find(id);

            cerere.User = db.Users.Find(cerere.UserId);
            Bursa bursa = db.Burse.Find(cerere.IdBursaCeruta);

            if (cerere.User != null)
            {
                ViewBag.Student = cerere.User.UserName;
            }
            else
            {
                ViewBag.Student = "Fara nume";
            }
            ViewBag.Bursa          = bursa;
            ViewBag.existaDocument = true;
            if (cerere.Document == null)
            {
                ViewBag.existaDocument = false;
            }
            return(View(cerere));
        }
Beispiel #8
0
        public ActionResult New()
        {
            Bursa bursa = new Bursa();

            return(View(bursa));
        }