title: Whay my Enum property be changed in http-response?
body: <p>I have a <code>web-service</code> and have this code:</p>
  
  <pre><code>roomStay = new RoomStay
              {
                  PlaceType = stay.hotelInfo.propertyType,
                  GeneralDescription = GenerateGeneralDescription(stay.hotelInfo).Result,
                  IsRefundableRoom = !stay.nonRefundable,
                  ProviderType = Supplier.BetterBooking,
                  BasicPropertyInfo = new BasicPropertyInfo
                  {
                      SupplierCode = stay.hotelInfo?.hotelName + stay.hotelInfo?.areaName
                                                            ,
                      Images = imageList,
                      NewImages = newImageList.ToArray()
                                                            ,
                      Address = $"{area + address + city + countryName  }" //$"{hotelStaticDataResult.hotelInfo?.address?.countryName} {hotelStaticDataResult.hotelInfo?.address?.cityName} {string.Join(" ", hotelStaticDataResult.hotelInfo?.address?.addressLines.ToArray())}"
                                                            ,
                      City = ""//cityName
                                                            ,
                      Name = stay.hotelInfo.hotelName
                                                            ,
                      Facilities = new List&lt;FacilityCategory&gt;()//facilitieList
                                                              ,
                      Longitude = longitude//hotelStaticDataResult.hotelInfo?.position.longitude
                                                              ,
                      Latitude = latitude// hotelStaticDataResult.hotelInfo?.position.latitude
                                                              ,
                      Telephone = string.Empty//hotelStaticDataResult?.hotelInfo?.contactNumbers?.Where(a =&gt; a.phoneType == "Phone").FirstOrDefault()?.phoneNumber
                                                              ,
                      Description = string.Empty,
                      TextItems = stay.hotelInfo?.textItems.Select(a =&gt; new TextItemsModelOTA()
                      {
                          Title = a.title == null || string.IsNullOrEmpty(a.title) ? string.Empty : a.title,
                          Description = a.description == null || string.IsNullOrEmpty(a.description) ? string.Empty : a.description,
                          TitleEnumType = (TitleEnumType)Utility.GetEnum&lt;TitleEnumType&gt;(a.title).Result
                      })//hotelStaticDataResult.hotelInfo?.textItems.ToJson()
                                                              ,
                      Code = hotelKey// searchrs.Result.transactionId + "$" + searchrs.Result.searchId + "$" + stay.stayId + "$" + stay.hotelInfo.hotelName
                                                              ,
                      RateProviderKeyValues = new List&lt;RateProviderKeyValue&gt;() { new RateProviderKeyValue() { Key = decimal.Parse(stay.hotelInfo.starRating.ToStringSafe()), Value = RateProvider.AAA } }.ToArray()
  
                  },
                  RoomRates = roomRate
                                                  ,
              };
  </code></pre>
  
  <p>In the <code>TextItem</code> property, I have TextEnumType property that this type is enum like:</p>
  
  <pre><code>public enum TitleEnumType
      {
          Facilities = 0,
          Rooms = 1,
          Meals = 2,
          Payment = 3,
          PropertyDescription = 4,
          NumberOfRooms = 5,
          CheckInTime = 6,
          CheckOutTime = 7,
          HotelRemarks = 8,
          None = 9
      }
  </code></pre>
  
  <p>With tow method that are below, I get the string with <code>GetStringForEnum(string model)</code> method and convert to <code>Enum</code> using <code>GetEnum&lt;T&gt;(string model)</code> like:</p>
  
  <pre><code>public static int GetEnum&lt;T&gt;(string model)
      {
          var newModel = GetStringForEnum(model);
  
          if (!Enum.IsDefined(typeof(T), newModel))
          {
              return (int)Enum.Parse(typeof(T), "None", true);
  
          }
  
          return (int)Enum.Parse(typeof(T), newModel, true);
      }
  
      private static string GetStringForEnum(string model)
      {
          Regex rgx = new Regex("[^a-zA-Z0-9 -]");
          var nonAlphanumericData = rgx.Matches(model);
          if (nonAlphanumericData.Count &lt; 0)
          {
              return model;
          }
          foreach (var item in nonAlphanumericData)
          {
              model = model.Replace((string)item, "");
          }
          return model;
      }
  </code></pre>
  
  <p><strong>Note:</strong> the <code>GetEnum&lt;T&gt;(string model)</code> method generate enum as true.</p>
  
  <p>After my <code>roomStay</code> model be generated and before send this <code>roomStay</code> <code>http-response</code> all of my data is correct. but when I receive this <code>roomStay</code> in my website and <code>controller</code>, this <code>roomStay</code> is not correct.</p>
  
  <p>What is my problem?</p>