public bool UpdatePassword(User_Com user_Pass, int?ID, string oldPass) { try { using (FBEntities entities = new FBEntities()) { var user = entities.User_Com.Where(x => x.ID == ID).FirstOrDefault(); if (user.Password != oldPass) { return(false); } else { user.Password = user_Pass.Password; entities.SaveChanges(); return(true); } } } catch (Exception ex) { throw ex; } }
public void NewUser1(User_Com _Com, User_PI _PI) { try { UserPI.Add(_PI); _Com.ID = _PI.ID; UserCom.Add(_Com); } catch (Exception ex) { throw ex; } }
//public bool OldPassControl(int? ID,string pass) { // try // { // var oldPassControl = UserCom.GetSourceList(x => x.ID == ID).Where(x=> x.Password==pass).FirstOrDefault(); // if (oldPassControl!=null) // { // return true; // } // else // { // return false; // } // } // catch (Exception ex) // { // throw ex; // } //} public void UpdateUserInfo(User_PI user_PI, User_Com user_Com, int?ID) { try { var user = UserPI.GetSourceList(x => x.ID == ID).FirstOrDefault(); if (user != null) { user.UName = user_PI.UName; user.Cinsiyet = user_PI.Cinsiyet; user.BirdDay = user_PI.BirdDay; user.IMG = user_PI.IMG; UserPI.Update(user); } else { } var userCom = UserCom.GetSourceList(x => x.ID == ID).FirstOrDefault(); if (userCom != null) { userCom.Mail = user_Com.Mail; userCom.Phone = user_Com.Phone; userCom.Adress = user_Com.Adress; UserCom.Update(userCom); } else { } } catch (Exception ex) { throw ex; } }