public ActionResult AddInterest(CreateInterestRequest createRequest)
        {
            if (!_validator.Validate(createRequest))
            {
                return(BadRequest(new { error = "Does Your Interest Have A Title?" }));
            }

            var newInterest = _interestRepository.AddInterest(createRequest.Name);

            return(Created($"api/interests/{newInterest.Id}", newInterest));
        }
Ejemplo n.º 2
0
        public ActionResult AddInterest(CreateInterestRequest createRequest)
        {
            if (!_validator.ValidateInterest(createRequest))
            {
                return(BadRequest(new { error = "users must have an interest name" }));
            }

            var newInterestList = _interestRepository.AddInterest(createRequest.InterestName, createRequest.UserId);
            var listOfInterestWithSameUserId = newInterestList.Where(x => x.UserId == createRequest.UserId).ToList();

            return(Created($"api/{listOfInterestWithSameUserId}", listOfInterestWithSameUserId));
        }
Ejemplo n.º 3
0
        public ActionResult CreateInterest(Interests interestObject)
        {
            var newInterest = InterestRepository.AddInterest(interestObject);

            return(Created($"api/createdInterest/{newInterest.Id}", newInterest));
        }