public static AdministratorContract ToContract(this AdministratorInternal entity) { if (entity == null) { return(null); } var admin = new AdministratorContract { Name = entity.Name, PersonalCode = entity.PersonalCode, Surname = entity.Surname, DormitoryId = entity.Dormitory.ID }; return(admin); }
public static AdministratorInternal ToInternal(this AdministratorContract entity) { if (entity == null) { return(null); } MainDbModelContainer1 db = new MainDbModelContainer1(); DormitoryInternal adminDormitory = db.DormitorySet.Find(entity.DormitoryId); var admin = new AdministratorInternal { Name = entity.Name, PersonalCode = entity.PersonalCode, Surname = entity.Surname, Dormitory = adminDormitory }; return(admin); }