public ActionResult Edit(CredSetupModel cvm) { //if (ModelState.IsValid) //{ var cred = new CredentialSetup { ServerUsername = cvm.ServerUsername, ServerPassword = cvm.ServerPassword, HostUsername = cvm.HostUsername, HostPassword = cvm.HostPassword, InventoryId = cvm.InventoryId, HostId = cvm.HostId, Date = cvm.Date //Locations = uvm.Locations }; if (TryUpdateModel(cred)) { _cred.Edit(cred); _cred.SaveChanges(); TempData["Success"] = "Edited Successfully!"; return(RedirectToAction("Index")); } ViewBag.message = "Fill all parameters"; return(View()); }
public ActionResult Create() { var Inventory = InventoryManager.GetAll().ToList(); var Host = hostManager.GetAll().ToList(); CredSetupModel cred = new CredSetupModel { Hosts = Host, Inventories = Inventory }; return(View(cred)); }
public ActionResult Create(CredSetupModel cvm) { if (ModelState.IsValid) { var cred = new CredentialSetup { ServerUsername = cvm.ServerUsername, ServerPassword = cvm.ServerPassword, HostUsername = cvm.HostUsername, HostPassword = cvm.HostPassword, InventoryId = cvm.InventoryId, HostId = cvm.HostId, Date = cvm.Date //Locations = uvm.Locations }; _cred.Add(cred); _cred.SaveChanges(); TempData["Success"] = "Added Successfully!"; return(RedirectToAction("Index")); } var Inventory = InventoryManager.GetAll().ToList(); var Host = hostManager.GetAll().ToList(); CredSetupModel credModel = new CredSetupModel { Hosts = Host, Inventories = Inventory }; return(View(credModel)); }