public ActionResult UpdateThongTinCaNhan(FormCollection f, HttpPostedFileBase file) { string fileName; if (file != null) { fileName = Path.GetFileNameWithoutExtension(file.FileName); fileName += Path.GetExtension(file.FileName); string folderPath = Server.MapPath("~") + @"Assets/avatar"; if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } string path = Path.Combine(folderPath, fileName); file.SaveAs(path); } else { fileName = ""; } NguoiDungDAO nd = new NguoiDungDAO(); int id = Convert.ToInt32(f["id"]); var detail = nd.Detail(id); detail.DiaChi = f["diachi"]; detail.TaiKhoan = f["taikhoan"]; detail.TenNguoiDung = f["ten"]; detail.Email = f["email"]; detail.AnhDaiDien = fileName; Session["taikhoan"] = detail; nd.UpdateThongTinCaNhan(detail); return(RedirectToAction("ThongTinCaNhan", "NguoiDung")); }
public ActionResult Update(int id) { var up = dao.Detail(id); return(View(up)); }