Ejemplo n.º 1
0
 public bool UpdateAccount(string id, UpdateProfileViewModal model)
 {
     ThanhVien tv = new ThanhVien();
     tv.HoTen = model.Name;
     tv.NgaySinh = model.Birthday;
     tv.GioiTinh = model.IsMale;
     tv.DiaChi = model.Address;
     tv.TinhTrang = true;
     tv.Avatar = model.Avatar;
     return bus.updateProfile(id, tv);
 }
Ejemplo n.º 2
0
 public UpdateProfileViewModal GetUpdateProfileViewModal(string Id)
 {
     ThanhVien member = bus.getMemberByUserId(Id);
     if (member == null) return null;
     UpdateProfileViewModal model = new UpdateProfileViewModal();
     model.IsMale = member.GioiTinh ?? true;
     model.Name = member.HoTen;
     model.Birthday = member.NgaySinh;
     model.Address = member.DiaChi;
     model.Avatar = member.Avatar;
     return model;
 }
Ejemplo n.º 3
0
        public ActionResult UpdateProfile(UpdateProfileViewModal model, HttpPostedFileBase file)
        {


            String fileName = "";
            if (file != null && file.ContentLength > 0)
            {
                fileName = Path.GetFileName(file.FileName);
                var path = Path.Combine(Server.MapPath("~/Images/"), fileName);
                file.SaveAs(path);
            }
            if (fileName != "")
                model.Avatar = "/Images/" + fileName;
            else
                model.Avatar = (String)TempData["currentAvatar"];

            if (ModelState.IsValid)
            {
                var id = User.Identity.GetUserId();
                AC.UpdateAccount(id, model);
                return Content("Cập nhật thành công!");
            }
            return Content("Không thể cập nhật! Vui lòng kiểm tra lại thông tin!");
        }