public ActionResult Edit(UsuarioView view)
        {
            if (ModelState.IsValid)
            {
                var db2     = new ControleContext();
                var oldUser = db2.Usuarios.Find(view.Usuario.UserId);
                db2.Dispose();


                if (view.Foto != null)
                {
                    var pic = Utilidades.UploadPhoto(view.Foto);
                    if (!string.IsNullOrEmpty(pic))
                    {
                        view.Usuario.Photo = string.Format("~/Content/Fotos/{0}", pic);
                    }
                }
                else
                {
                    view.Usuario.Photo = oldUser.Photo;
                }

                // db2 = new ControleContext();
                // oldUser = db2.Usuarios.Find(view.Usuario.UserId);
                //db2.Dispose();

                db.Entry(view.Usuario).State = EntityState.Modified;
                try
                {
                    if (oldUser != null && oldUser.UserName != view.Usuario.UserName)
                    {
                        Utilidades.ChangeEmailUserAsp(oldUser.UserName, view.Usuario.UserName);
                    }
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError(string.Empty, ex.Message);
                    return(View(view));
                };
                return(RedirectToAction("Index"));
            }
            return(View(view.Usuario));
        }