Example #1
0
 /// <summary>
 /// Cập nhật người dùng
 /// </summary>
 /// <param name="us">User</param>
 /// <returns>bool</returns>
 public bool UpdateUser(StudyOnline.Entities.Models.User us)
 {
     using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline())
     {
         try
         {
             var c = _db.User.Find(us.ID);
             c.UserName     = us.UserName;
             c.Password     = us.Password;
             c.Name         = us.Name;
             c.Address      = us.Address;
             c.Email        = us.Email;
             c.Phone        = us.Phone;
             c.Avatar       = us.Avatar;
             c.Status       = us.Status;
             c.CreatedDate  = us.CreatedDate;
             c.CreatedBy    = us.CreatedBy;
             c.ModifiedDate = us.ModifiedDate;
             c.ModifiedBy   = us.ModifiedBy;
             //c.GroupID = us.GroupID;
             //c.PayID = us.PayID;
             _db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Example #2
0
 /// <summary>
 /// Tạo người dùng
 /// </summary>
 /// <param name="tq">User</param>
 /// <returns>long</returns>
 public long CreateUser(StudyOnline.Entities.Models.User tq)
 {
     using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline())
     {
         try
         {
             //User data = new User();
             //data.UserName = tq.UserName;
             //data.Name = tq.Name;
             //data.Address = tq.Address;
             //data.Email = tq.Email;
             //data.Phone = tq.Phone;
             //data.Avatar = tq.Avatar;
             //data.Password = Encryptor.MD5Hash(tq.Password);
             //data.Status = false;
             _db.User.Add(tq);
             _db.SaveChanges();
             return(tq.ID);
         }
         catch (Exception)
         {
             return(-1);
         }
     }
 }
Example #3
0
 public bool UpdateUser(StudyOnline.Entities.Models.User us)
 {
     return(userRepository.UpdateUser(us));
 }
Example #4
0
 public long CreateUser(StudyOnline.Entities.Models.User tq)
 {
     return(userRepository.CreateUser(tq));
 }