public ActionResult Edit(Client client)
        {
            const string dummyPassword = "******";

            if (String.IsNullOrWhiteSpace(client.Password))
            {
                ModelState["Password"].Errors.Clear();
                client.Password = dummyPassword;
            }

            if (ModelState.IsValid)
            {
                db.Entry(client).State = EntityState.Modified;
                db.SaveChanges();

                if (client.Password != dummyPassword)
                {
                    var user = UserManager.FindByName(client.Email);
                    UserManager.RemovePassword(user.Id);
                    UserManager.AddPassword(user.Id, client.Password);
                }

                return(RedirectToAction("Index"));
            }
            return(View(client));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "Id,CreationDate,Severity,Category,Note")] Ticket ticket)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ticket).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ticket));
 }