WebApp.ViewModels.HousingEditModel.UpdatePhone C# (CSharp) Method

UpdatePhone() private static method

private static UpdatePhone ( Housing item, int order, string phone ) : void
item WebApp.Entities.Housing
order int
phone string
return void
        private static void UpdatePhone(Housing item, int order, string phone)
        {
            var housingPhone = item.Phones.SingleOrDefault(x => x.Order == order);
            if (housingPhone != null)
            {
                housingPhone.Number = phone;
            }
            else if(!string.IsNullOrEmpty(phone))
            {
                housingPhone = new HousingPhone { Number = phone, Order = order };
                item.Phones.Add(housingPhone);
            }
        }
    }