Beispiel #1
0
        public IActionResult AddFriend(int id, Clinker friendToAdd)
        {
            var clinkerToUpdate = _repository.GetById(id);

            if (!clinkerToUpdate.Friends.Any(c => c.Name == friendToAdd.Name))
            {
                _repository.AddClinkerFriend(id, friendToAdd);
            }
            else
            {
                return(BadRequest($"Already friends with {friendToAdd.Name}"));
            }

            var updatedClinker = _repository.GetById(id);

            return(Ok(updatedClinker));
        }