예제 #1
0
        public ActionResult Create(NetworkAddress networkaddress)
        {
            #region Authorization
            if( Authentication.IsAdmin == false )
            {
                return RedirectToAction( "Login", "Users" );
            }
            #endregion

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

            return View(networkaddress);
        }
예제 #2
0
        public ActionResult Edit(NetworkAddress networkaddress)
        {
            #region Authorization
            if( Authentication.IsAdmin == false )
            {
                return RedirectToAction( "Login", "Users" );
            }
            #endregion

            if (ModelState.IsValid)
            {
                db.Entry(networkaddress).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(networkaddress);
        }