Example #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);
 }
Example #2
0
       // Tạo một profile mới cho user
        public ThanhVien createNewProfile(ThanhVien tv)
        {
            try
            {
                db.ThanhVien.Add(tv);
                db.SaveChanges();
                return tv;
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);              
                return null;
            }

        }
Example #3
0
        public bool CreateProfile(ApplicationUser user, RegisterViewModel model)
        {
            ThanhVien member = new ThanhVien();
            member.TinhTrang = true;
            member.HoTen = model.Name;
            member.NgaySinh = model.Birthday;

            member.Avatar = "/Images/avatar_default.png";
            member.DiaChi = model.Address;
            member.GioiTinh = model.IsMale;
            member.MS_TaiKhoan = user.Id;
            member = bus.createNewProfile(member);
            if (member != null)
            {
                return true;
            }
            return false;
        }
Example #4
0
 // Cập nhật thông tin tài khoản
 public bool updateProfile(string id, ThanhVien member)
 {
     try
     {
         ThanhVien mem = getMemberByUserId(id);
         if (mem != null)
         {
             mem.HoTen = member.HoTen;
             mem.NgaySinh = member.NgaySinh;
             mem.GioiTinh = member.GioiTinh;
             mem.DiaChi = member.DiaChi;
             mem.TinhTrang = member.TinhTrang;
             db.SaveChanges();
             return true;
         }
         return false;
     }
     catch (Exception ex)
     {
         Debug.Print(ex.Message);
         return false;
     }
 }