Esempio n. 1
0
        public ActionResult Create([Bind(Include = "WiadomoscId,Subject,ShortContent,Content")] Wiadomosc wiadomosc)
        {
            if (ModelState.IsValid)
            {
                db.Wiadomosc.Add(wiadomosc);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(wiadomosc));
        }
Esempio n. 2
0
        public ActionResult Create([Bind(Include = "TematId,Nazwa,KategoriaId")] PomocTechnicznaTematy pomocTechnicznaTematy)
        {
            if (ModelState.IsValid)
            {
                db.PomocTechnicznaTematy.Add(pomocTechnicznaTematy);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.KategoriaId = new SelectList(db.PomocTechnicznaKategorie, "KategoriaId", "Nazwa", pomocTechnicznaTematy.KategoriaId);
            return(View(pomocTechnicznaTematy));
        }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "PracownicyId,Imie,Nazwisko,Adres,Miasto,Wojewodztwo,KodPocztowy,TelefonDomowy,TelefonKomorkowy,Newsletter,DzialId")] Pracownicy pracownicy)
        {
            pracownicy.UserId = User.Identity.GetUserId();

            if (ModelState.IsValid)
            {
                db.Pracownicy.Add(pracownicy);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DzialId = new SelectList(db.Dzialy, "DzialId", "Nazwa", pracownicy.DzialId);
            return(View(pracownicy));
        }
Esempio n. 4
0
 public ActionResult UtworzRole(FormCollection collection)
 {
     try
     {
         db.Roles.Add(
             new IdentityRole()//Microsoft.AspNet.Identity.EntityFramework.
         {
             Name = collection["RoleName"]
         });
         db.SaveChanges();
         ViewBag.ResultMessage = "Rola utworzona pomyślnie";
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Esempio n. 5
0
        public ActionResult Create([Bind(Include = "PomocTechnicznaId,NunerStanowiska,Opis,KategoriaId,TematId")] PomocTechniczna pomocTechniczna)
        {
            pomocTechniczna.Status         = Status.Oczekuje;
            pomocTechniczna.DataZgloszenia = DateTime.Now;
            pomocTechniczna.UserId         = User.Identity.GetUserId();
            pomocTechniczna.AdresIp        = Request.UserHostAddress;

            if (pomocTechniczna.TematId == 0)
            {
                ModelState.AddModelError("TematId", "Wybierz poprawnie temat");
            }

            if (ModelState.IsValid)
            {
                db.PomocTechniczna.Add(pomocTechniczna);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.KategoriaId = new SelectList(db.PomocTechnicznaKategorie, "KategoriaId", "Nazwa", pomocTechniczna.KategoriaId);
            ViewBag.TematId     = new SelectList(db.PomocTechnicznaTematy, "TematId", "Nazwa", pomocTechniczna.TematId);
            return(View(pomocTechniczna));
        }
Esempio n. 6
0
 /// <summary>
 /// Zapisanie zmian
 /// </summary>
 public void SaveChanges()
 {
     _db.SaveChanges();
 }