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); }
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); }