Beispiel #1
0
        public ActionResult ModifikoProfesorinpOST(ProfesoriLista modeli)
        {
            try
            {
                var profesoriDB = db.tblPerdoruesi.Find(int.Parse(modeli.ProfesoriID));
                if (profesoriDB == null)
                {
                    Session["mesazhi"] = "Profesori nuk ekziston";
                    return(RedirectToAction("Index"));
                }
                CultureInfo myCItrad   = new CultureInfo("bg-BG", false);
                DateTime    parsedDate = DateTime.ParseExact(modeli.Datelindja, "dd-MM-yyyy", myCItrad);
                profesoriDB.Emri           = modeli.Emri;
                profesoriDB.Mbiemri        = modeli.Mbiemri;
                profesoriDB.Datelindja     = parsedDate;
                profesoriDB.Telefoni       = modeli.Telefoni;
                profesoriDB.Perdoruesi     = modeli.Perdoruesi;
                profesoriDB.Fjalekalimi    = modeli.Fjalekalimi;
                profesoriDB.KomunaID       = modeli.KomunaID;
                profesoriDB.DepartamentiID = modeli.DepartamentiID;

                profesoriDB.Datelindja      = parsedDate;
                db.Entry(profesoriDB).State = EntityState.Modified;
                db.SaveChanges();
                Session["mesazhi"] = "Profesori u modifikua me sukses.";

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                Session["Mesazhi"] = "Ka ndodhur nje gabim.";
                return(RedirectToAction("Index"));
            }
        }
Beispiel #2
0
        public ActionResult ModifikoSallenPost(SallatList modeli)
        {
            try
            {
                var sallaDB = db.tblKlasa.Find(modeli.KlasaID);
                if (sallaDB == null)
                {
                    Session["mesazhi"] = "Salla e tille nuk ekziston";
                    return(RedirectToAction("Index"));
                }

                sallaDB.Numri           = int.Parse(modeli.Numri);
                db.Entry(sallaDB).State = EntityState.Modified;
                db.SaveChanges();

                Session["mesazhi"] = "Salla u modifikua me sukses.";

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                Session["Mesazhi"] = "Ka ndodhur nje gabim.";
                return(RedirectToAction("Index"));
            }
        }
Beispiel #3
0
        public ActionResult ModifikoDepartamentinPost(DepartamentLista modeli)
        {
            try
            {
                var departamentiDB = db.tblDepartamenti.Find(modeli.DepartamentiID);
                if (departamentiDB == null)
                {
                    Session["mesazhi"] = "Departamenti i tille nuk ekziston";
                    return(RedirectToAction("Index"));
                }

                departamentiDB.Departamenti    = modeli.Departamenti;
                db.Entry(departamentiDB).State = EntityState.Modified;
                db.SaveChanges();

                Session["mesazhi"] = "Departamenti u modifikua me sukses.";

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                Session["Mesazhi"] = "Ka ndodhur nje gabim.";
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult ModifikoAfatinPost(AfatiLista modeli)
        {
            try
            {
                var afatiDB = db.tblAfati.Find(int.Parse(modeli.AfatiID));
                if (afatiDB == null)
                {
                    Session["mesazhi"] = "Afati nuk ekziston";
                    return(RedirectToAction("Index"));
                }
                afatiDB.Afati           = modeli.Afati;
                afatiDB.DataFillimit    = DateTime.Parse(modeli.DataFillimit);
                afatiDB.DataMbarimit    = DateTime.Parse(modeli.DataMbarimit);
                afatiDB.NumriProvimeve  = int.Parse(modeli.NumriProvimeve);
                afatiDB.Aktiv           = modeli.Aktiv;
                db.Entry(afatiDB).State = EntityState.Modified;
                db.SaveChanges();
                Session["mesazhi"] = "Afati u modifikua me sukses.";

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                Session["Mesazhi"] = "Ka ndodhur nje gabim.";
                return(RedirectToAction("Index"));
            }
        }
Beispiel #5
0
        public ActionResult VendosNotenPost(ParaqitjaProvimeveNota modeli)
        {
            int pid = int.Parse(Session["ParaqitjaProvimeveID"].ToString());
            var paraqitjaProvimeve = db.tblParaqitjaProvimeve.Find(pid);

            paraqitjaProvimeve.Nota            = int.Parse(modeli.Nota);
            db.Entry(paraqitjaProvimeve).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            Session["Mesazhi"] = "Nota u vendos me sukses.";
            return(RedirectToAction("Index"));
        }
Beispiel #6
0
        public ActionResult ModifikoLendenPost(LendaList modeli)
        {
            try
            {
                //var LendaID=int.Parse(Session[])
                var t = db.tblLenda.FirstOrDefault(x => x.Emri == modeli.Emri);
                if (t == null)
                {
                    var lendaDB = db.tblLenda.Find(modeli.LendaID);
                    if (lendaDB == null)
                    {
                        Session["mesazhi"] = "Lenda nuk ekziston";
                        return(RedirectToAction("Index"));
                    }
                    lendaDB.Emri            = modeli.Emri;
                    lendaDB.Pershkrimi      = modeli.Pershkrimi;
                    db.Entry(lendaDB).State = EntityState.Modified;
                    db.SaveChanges();

                    var lendaProfesoriDB = db.tblProfesoriLenda.Find(modeli.ProfesoriLendaID);
                    lendaProfesoriDB.ProfesoriID     = modeli.ProfesoriID;
                    db.Entry(lendaProfesoriDB).State = EntityState.Modified;
                    db.SaveChanges();
                    Session["mesazhi"] = "Lenda u modifikua me sukses.";

                    return(RedirectToAction("Index"));
                }
                else
                {
                    var check2 = db.tblProfesoriLenda.Any(x => x.ProfesoriID == modeli.ProfesoriID && x.LendaID == t.LendaID);
                    if (check2)
                    {
                        Session["Mesazhi"] = "Lenda me kete profesor, ekziston ne sistem!";
                        return(RedirectToAction("Index"));
                    }
                    var lendaDB = db.tblLenda.Find(modeli.LendaID);
                    if (lendaDB == null)
                    {
                        Session["mesazhi"] = "Lenda nuk ekziston";
                        return(RedirectToAction("Index"));
                    }
                    lendaDB.Emri            = modeli.Emri;
                    lendaDB.Pershkrimi      = modeli.Pershkrimi;
                    db.Entry(lendaDB).State = EntityState.Modified;
                    db.SaveChanges();

                    var lendaProfesoriDB = db.tblProfesoriLenda.Find(modeli.ProfesoriLendaID);
                    lendaProfesoriDB.ProfesoriID     = modeli.ProfesoriID;
                    db.Entry(lendaProfesoriDB).State = EntityState.Modified;
                    db.SaveChanges();
                    Session["mesazhi"] = "Lenda u modifikua me sukses.";

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception e)
            {
                Session["Mesazhi"] = "Ka ndodhur nje gabim. " + e.Message;

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