예제 #1
0
 public PhoneModel Create(Phone phone)
 {
     return new PhoneModel
     {
         Number = phone.Number
     };
 }
예제 #2
0
 public Phone Parse(int userId, PhoneModel phoneModel)
 {
     try
     {
         var phone = new Phone();
         if (!string.IsNullOrEmpty(phoneModel.Number))
         {
             phone.Number = phoneModel.Number;
         }
         if (context.Users.Any(u => u.Id == userId))
         {
             phone.UserID = userId;
         }
         return phone;
     }
     catch (Exception ex)
     {
         return null;
     }
 }