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)); }
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)); }
public ActionResult CreateInterest(Interests interestObject) { var newInterest = InterestRepository.AddInterest(interestObject); return(Created($"api/createdInterest/{newInterest.Id}", newInterest)); }