public long Insert(Member member) { member.IDMemType = 3; member.PassWord = MaHoa.MaHoaSangMD5(member.PassWord); db.Members.Add(member); db.SaveChanges(); return(member.IDMember); }
public long Insert(Member employee, int IdMemType) { employee.IDMemType = IdMemType; employee.PassWord = MaHoa.MaHoaSangMD5(employee.PassWord); db.Members.Add(employee); db.SaveChanges(); return(employee.IDMember); }
public bool Update(Member model) { var admin = db.Members.Where(x => x.IDMemType == 1).SingleOrDefault(); admin.FullName = model.FullName; if (admin.PassWord == model.PassWord) { admin.PassWord = model.PassWord; } else { admin.PassWord = MaHoa.MaHoaSangMD5(model.PassWord); } admin.Address = model.Address; admin.Email = model.Email; admin.PhoneNumber = model.PhoneNumber; admin.Avatar = model.Avatar; admin.IDCard = model.IDCard; db.SaveChanges(); return(true); }
public void Edit(Member member) { var temp = db.Members.Find(member.IDMember); temp.UserName = member.UserName; temp.PassWord = member.PassWord; if (temp.PassWord == member.PassWord) { temp.PassWord = member.PassWord; } else { temp.PassWord = MaHoa.MaHoaSangMD5(member.PassWord); } MaHoa.MaHoaSangMD5(member.PassWord); temp.FullName = member.FullName; temp.Email = member.Email; temp.Address = member.Address; temp.PhoneNumber = member.PhoneNumber; temp.Avatar = member.Avatar; db.SaveChanges(); }
public void Edit(Member employee) { var temp = db.Members.Find(employee.IDMember); temp.IDMemType = employee.IDMemType; temp.UserName = employee.UserName; if (temp.PassWord == employee.PassWord) { temp.PassWord = employee.PassWord; } else { temp.PassWord = MaHoa.MaHoaSangMD5(employee.PassWord); } temp.FullName = employee.FullName; temp.IDCard = employee.IDCard; temp.Email = employee.Email; temp.Address = employee.Address; temp.PhoneNumber = employee.PhoneNumber; temp.Salary = employee.Salary; temp.Avatar = employee.Avatar; db.SaveChanges(); }