public ActionResult Edit(ReportServer reportserver) { if (!reportserver.PasswordSet) { ModelState.AddModelError("PasswordUnmasked", Resources.ProvideAccountPassword); } reportserver.UpdatePassword(db); if (ModelState.IsValid) { db.Entry(reportserver).State = EntityState.Modified; db.Entry(reportserver).Property(l => l.Password).IsModified = reportserver.PasswordSet; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(reportserver)); }
public ActionResult Create(ReportServer reportserver) { if (!reportserver.PasswordSet) { ModelState.AddModelError("PasswordUnmasked", Resources.ProvideAccountPassword); } reportserver.UpdatePassword(db); if (ModelState.IsValid) { db.ReportServers.Add(reportserver); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(reportserver)); }