// GET: Index public ActionResult Index() { var list = _DxGlobalLogErrorService.FindPagedListBySql("", "", null, 1, 20); Common.ShowT <int>(1); //调用泛型 Common.ShowT("1111"); //T可以省去 系统会自定推算 BasePhone basePhone = PhoneFactory.CreatePhone(1); // Common.Getclass("111"); return(View()); }
/// <summary> /// Add new phone /// </summary> /// <param name="phoneDTO"></param> /// <param name="profile"></param> private void SavePhone(PhoneDTO phoneDTO, Profile profile) { if (phoneDTO == null) { throw new ArgumentException(Messages.warning_CannotAddProfileWithNullInformation); } // Create a new Phone entity Phone phone = PhoneFactory.CreatePhone(phoneDTO.Number, "Anand", DateTime.Now, "Anand", DateTime.Now); phone = SavePhone(phone); PhoneType phoneType = _phoneTypeRepository.Get(phoneDTO.PhoneTypeId); // Create a new ProfilePhone entity ProfilePhone profilePhone = ProfilePhoneFactory.CreateProfilePhone(profile, phone, phoneType, "Anand", DateTime.Now, "Anand", DateTime.Now); SaveProfilePhone(profilePhone); }
/// <summary> /// Add new phone /// </summary> /// <param name="phoneDTO"></param> /// <param name="profile"></param> void SavePhone(PhoneDTO phoneDTO, Profile profile) { //if phoneDTO data is not valid if (phoneDTO == null) { throw new ArgumentException(Messages.warning_CannotAddProfileWithNullInformation); } //Create a new Phone entity var newPhone = PhoneFactory.CreatePhone(phoneDTO.Number, "Anand", DateTime.Now, "Anand", DateTime.Now); //Save new Phone newPhone = SavePhone(newPhone); var phoneType = _phoneTypeRepository.Get(phoneDTO.PhoneTypeId); //Create a new Profile Phone entity var newProfilePhone = ProfilePhoneFactory.CreateProfilePhone(profile, newPhone, phoneType, "Anand", DateTime.Now, "Anand", DateTime.Now); //Save new Profile Phone SaveProfilePhone(newProfilePhone); }