Ejemplo n.º 1
0
 public ActionResult Edit(FormCollection f)
 {
     /* User usr = db.Users.First(p => p.IDUser.Trim() == HttpContext.User.Identity.Name);
      * // User usr = new User();
      * usr.IDUser = f["User"];
      * usr.PassUser = f["Pass"];
      * usr.HoTenUser = f["Fullname"];
      * usr.Email = f["Email"];
      * usr.DiaChi = f["DiaChi"];
      * string s = f["Dienthoai"];
      * decimal d = decimal.Parse(s);
      * usr.SoDienThoai = f["Dienthoai"];
      *
      * usr.Ngaysinh = f["Ngaysinh"]; ;
      * //  int a = usr.Quyen;
      * //   usr.Quyen = a;
      * if (ModelState.IsValid)
      * {
      *
      *   UpdateModel(usr);
      *   //db.Users.Attach(usr);
      *   //int result = db.Database.ExecuteSqlCommand(sql, parameters);
      *   //  db.ObjectStateManager.ChangeObjectState(usr, System.Data.EntityState.Modified);
      *   // ((IObjectContextAdapter)db).ObjectContext.ObjectStateManager.(usr, System.Data.EntityState.Modified);
      *   db.SaveChanges();
      * }*/
     svuser.EditUser(HttpContext.User.Identity.Name, f["User"], f["Pass"], f["Fullname"], f["Email"], f["DiaChi"], f["Dienthoai"], f["Ngaysinh"]);
     return(RedirectToAction("Index", "SanPham"));
 }
Ejemplo n.º 2
0
 public bool EditUser(string oldUsername, string newUsername, string newPassword, string newName, string newSurname)
 {
     try
     {
         return(serviceUser.EditUser(oldUsername, newUsername, newPassword, newName, newSurname));
     }
     catch {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Connection Error! Database Server Manager Unreacheable!");
         Console.ForegroundColor = ConsoleColor.DarkCyan;
     }
     return(false);
 }
        private void btnsua_Click(object sender, EventArgs e)
        {
            string user     = txtUser.Text.ToString();
            string pass     = txtPass.Text.ToString();
            string fullname = txtFullname.Text.ToString();
            string email    = txtemail.Text.ToString();
            string diachi   = txtDiaChi.Text.ToString();
            string sdt      = txtsdt.Text.ToString();
            string ngaysinh = txtngay.Text.ToString();

            svuser.EditUser(user, user, pass, fullname, email, diachi, sdt, ngaysinh);
            MessageBox.Show("Sửa Thành Công");
            dvUser.DataSource = null;
            dvUser.DataSource = svuser.All();
        }