/// <summary> - NewUser: add new user to user tbl in db. public static Users__tbl NewUser(Users__tbl udal) { try { using (projectDBEntities5 db = new projectDBEntities5()) { Users__tbl newUser = new Users__tbl { UserName = udal.UserName, UserLastName = udal.UserLastName, UserMail = udal.UserMail, UserPassword = udal.UserPassword, UserType = udal.UserType }; db.Users__tbl.Add(newUser); db.SaveChanges(); return(newUser); } } catch (Exception e) { Console.WriteLine(e); return(null); } }
public UserDTO(DAL.Users__tbl user) { this.UserCode = user.UserCode; this.UserLastName = user.UserLastName; this.UserName = user.UserName; this.UserMail = user.UserMail; this.UserPassword = user.UserPassword; this.UserType = user.UserType; }
/// <summary> - Exist: check if user is exist. public static Users__tbl Exist(Users__tbl u) { try { using (projectDBEntities5 db = new projectDBEntities5()) { Users__tbl User = db.Users__tbl.Where(x => x.UserPassword == u.UserPassword && x.UserName == u.UserName).FirstOrDefault(); return(User); } } catch (Exception e) { Console.WriteLine(e); return(null); } }