public static DepartmentViewModel MToVM(Department model) { return new DepartmentViewModel() { ID = model.ID, Name = model.Name, Company = CompanyUtility.MToVM(model.Company) }; }
public static UsersViewModel MToVM(User user) { var temp = new UsersViewModel() { ID = user.ID, Code = Comparison.IsNullOrEmpty(user.Code) ? "" : user.Code, LastName = Comparison.IsNullOrEmpty(user.LastName) ? "" : user.LastName, MiddleName = Comparison.IsNullOrEmpty(user.MiddleName) ? "" : user.MiddleName, FirstName = Comparison.IsNullOrEmpty(user.FirstName) ? "" : user.FirstName, ExtensionName = Comparison.IsNullOrEmpty(user.ExtensionName) ? "" : user.ExtensionName, Gender = Comparison.IsNullOrEmpty(user.Gender) ? "N/A" : user.Gender, MaritalStatus = Comparison.IsNullOrEmpty(user.MaritalStatus) ? "N/A" : user.MaritalStatus, Nationality = Comparison.IsNullOrEmpty(user.Nationality) ? "N/A" : user.Nationality, Religion = Comparison.IsNullOrEmpty(user.Religion) ? "N/A" : user.Religion, Address = Comparison.IsNullOrEmpty(user.Address) ? "N/A" : user.Address, Birthday = TimeFormatter.DateToString(user.Birthday.Value), Jobtitle = JobTitleUtility.MToVM(user.JobTitle), Email = Comparison.IsNullOrEmpty(user.Email) ? "N/A" : user.Email, ContactPerson = Comparison.IsNullOrEmpty(user.ContactPerson) ? "N/A" : user.ContactPerson, ContactNumber = Comparison.IsNullOrEmpty(user.ContactNumber) ? "N/A" : user.ContactNumber, profileImage = Comparison.IsNullOrEmpty(user.ProfileImage) ? "/Assets/images/no-image.jpg" : user.ProfileImage, Company = CompanyUtility.MToVM(user.Company), aspNetUser = MToVM(user.AspNetUser), Department = DataVerification.IsNull(user.Department) ? new DepartmentViewModel() { Name = "N/A" } : DepartmentUtility.MToVM(user.Department), JobStatus = JobStatusUtility.MToVM(user.JobStatu), User = AspNetUserUtility.MToVM(user.AspNetUser), TimeZone = user.TimeZone }; return(temp); }
public static AddOnViewModel MToVM(AddOn model) { return(new AddOnViewModel() { ID = model.ID, Description = model.Description, Company = CompanyUtility.MToVM(model.Company) }); }