public async Task <IActionResult> Edit(int id, [Bind("ZsiteId,site,report,active")] Zsite zsite) { if (id != zsite.ZsiteId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(zsite); TempData["Alert"] = String.Format("Saved Changes to Site: {0}", zsite.site); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ZsiteExists(zsite.ZsiteId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(zsite)); }
public async Task <IActionResult> Create([Bind("ZsiteId,site,report,active")] Zsite zsite) { if (ModelState.IsValid) { _context.Add(zsite); TempData["Alert"] = String.Format("Added Site: {0}", zsite.site); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(zsite)); }