示例#1
0
        private void ShowFriendOperatorWith()
        {
            if (selectedOperator == "Все" || selectedOperator == null)
            {
                return;
            }

            PhoneOperator phoneOperator = null;

            foreach (var item in PhoneOperators)
            {
                if (item.Name == selectedOperator)
                {
                    phoneOperator = item;
                }
            }
            if (phoneOperator == null)
            {
                return;
            }
            var tempList = CopyCollection(FriendsList);

            FriendsList.Clear();
            foreach (var friend in tempList)
            {
                if (phoneOperator.IsCodeContains(friend.NumberCode))
                {
                    FriendsList.Add(friend);
                }
            }
        }
        public async Task <IActionResult> PostPhoneOperators(PhoneOperator phoneOperator)
        {
            _context.PhoneOperators.Add(phoneOperator);
            await _context.SaveChangesAsync();

            return(StatusCode(201));
        }
        public async Task <IActionResult> PutPhoneOperators(int id, [FromBody] PhoneOperator phoneOperator)
        {
            phoneOperator.Id = id;
            _context.Entry(phoneOperator).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }