public async Task <IActionResult> Create([FromBody] CreateInterestRequest interest) { var command = new CreateInterestCommand(interest); var result = await Mediator.Send(command); return(await ResponseBase(result)); }
public ActionResult AddInterest(CreateInterestRequest createInterestRequest, int id) { var newInterestz = _userRepository.AddInterest(createInterestRequest.Name, createInterestRequest.Id); var newUserInterest = _userRepository.AddUserInterest(id, newInterestz.Id); return(Ok(newInterestz)); }
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([FromBody] CreateInterestRequest newInterestRequest) { if (_validator.InterestValidate(newInterestRequest)) { return(BadRequest(new { error = "All Of The Required Fields Not Met" })); } var newInterest = _interestsRepository.AddInterest(newInterestRequest.Name, newInterestRequest.UserId); return(Created($"api/interests/{newInterest.UserId}", 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 bool Validate(CreateInterestRequest requestToValidate) { return(!(string.IsNullOrEmpty(requestToValidate.Name))); }
public bool InterestValidate(CreateInterestRequest interestRequest) { return(string.IsNullOrEmpty(interestRequest.Name)); }
public CreateInterestCommand(CreateInterestRequest createInterestRequest) { CreateInterestRequest = createInterestRequest; }
public bool ValidateInterest(CreateInterestRequest request) { return(!string.IsNullOrEmpty(request.InterestName)); }