예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            LehrstuhlEintraege lehrstuhlEintraege = db.LehrstuhlEintraeges.Find(id);

            db.LehrstuhlEintraeges.Remove(lehrstuhlEintraege);
            db.SaveChanges();
            return(RedirectToAction("Index", new { lehrstuhlid = lehrstuhlEintraege.lehrstuhlid }));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "id,lehrstuhlid,datum,autor,inhalt,label1,label2,label3,label4,label5")] LehrstuhlEintraege lehrstuhlEintraege)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lehrstuhlEintraege).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", new { lehrstuhlid = lehrstuhlEintraege.lehrstuhlid }));
     }
     return(View(lehrstuhlEintraege));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "id,lehrstuhlid,datum,autor,inhalt,label1,label2,label3,label4,label5")] LehrstuhlEintraege lehrstuhlEintraege)
        {
            if (ModelState.IsValid)
            {
                db.LehrstuhlEintraeges.Add(lehrstuhlEintraege);
                db.SaveChanges();
                return(RedirectToAction("Index", new { lehrstuhlid = lehrstuhlEintraege.lehrstuhlid }));
            }

            return(View(lehrstuhlEintraege));
        }
예제 #4
0
        // Ermöglicht es, einen neuen Lehrstuhleintrag in einem bestimmten Lerhstuhl zu erstellen
        // (Import: lehrstuhlID, Export: lehrstuhlEintraegeModel)
        // GET: LehrstuhlEintraege/Create
        public ActionResult Create(int?lehrstuhlid)
        {
            if (lehrstuhlid == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            // lehrstuhlid, autor, datum im hintergrund vorbelegen
            LehrstuhlEintraege lehrstuhlEintraege = new LehrstuhlEintraege();

            lehrstuhlEintraege.lehrstuhlid = (int)lehrstuhlid;
            lehrstuhlEintraege.datum       = DateTime.Now;

            var userId = User.Identity.GetUserId();

            lehrstuhlEintraege.autor = userId;

            return(View(lehrstuhlEintraege));
        }
예제 #5
0
        // Löschung des Lehrstuhleintrags als
        // import: lehrstuhleintragid
        // export: lehrstuhleintraegeModel
        // redirect auf error view, falls keine authorizierung vorliegt.
        // GET: LehrstuhlEintraege/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var userId = User.Identity.GetUserId();
            int idauth = (int)id;

            if (AuthCheck.VerantLehr(idauth, userId) || AuthCheck.AutorLE(idauth, userId) || User.IsInRole("Admin"))
            {
                LehrstuhlEintraege lehrstuhlEintraege = db.LehrstuhlEintraeges.Find(id);
                if (lehrstuhlEintraege == null)
                {
                    return(HttpNotFound());
                }
                return(View(lehrstuhlEintraege));
            }

            return(RedirectToAction("Unauthorized", "Error"));
        }