Example #1
0
        public IActionResult AddFriendToMemory(string email, int id)
        {
            Memory m = _memoryRepository.GetById(id);

            if (m == null)
            {
                return(BadRequest());
            }

            User userToAdd = _userRepository.GetByEmail(email);

            if (userToAdd == null)
            {
                return(BadRequest());
            }

            m.AddMember(userToAdd);
            _memoryRepository.SaveChanges();

            return(NoContent());
        }