public ActionResult Edit(Guid? id) { Network network = new Network(); if (id != null) { network = reposetory.GetNetwork((Guid)id); } return View(network); }
public ActionResult Edit(Network network) { if (ModelState.IsValid) { Network dbNetwork = new Network(); if (network.NetworkID != Guid.Empty) dbNetwork = reposetory.GetNetwork(network.NetworkID); dbNetwork.NetworkName = network.NetworkName; dbNetwork.NetworkNotToShow = network.NetworkNotToShow; dbNetwork.NetworkNumber = network.NetworkNumber; if (reposetory.Save(dbNetwork)) { ModelState.Clear(); ViewBag.FormSucces = true; return View(dbNetwork); } else { ViewBag.HandledException = true; } } return View(network); }