public static List <propProfessor> Get() { var listProfessor = new List <propProfessor>(); var data = DataAccess.Professor.Get(); if (data == null) { return(null); } while (data.Read()) { propProfessor professor = new propProfessor(); professor.id = int.Parse(data["Id"].ToString()); professor.fullName = data["FullName"].ToString(); professor.email = data["Email"].ToString(); professor.username = data["Username"].ToString(); professor.password = data["Password"].ToString(); professor.phoneNumber = data["PhoneNumber"].ToString(); professor.address = data["Address"].ToString(); professor.createdAt = DateTime.Parse(data["CreatedAt"].ToString()); professor.createdBy = int.Parse(data["CreatedBy"].ToString()); professor.status = bool.Parse(data["Status"].ToString()); professor.avatar = (byte[])(data["avatar"]); listProfessor.Add(professor); } data.Close(); return(listProfessor); }
public ProfessorViewModel(Business.propProfessor obj) { this.id = obj.id; this.fullName = obj.fullName; this.email = obj.email; this.username = obj.username; this.password = obj.password; this.phoneNumber = obj.phoneNumber; this.address = obj.address; this.createdBy = obj.createdBy; this.createdAt = obj.createdAt; this.createdByStr = obj.createdByStr; this.avatar = obj.avatar; }