public async Task <IActionResult> UpdateFilter([FromBody] UpdateFilterRequest updateFilterRequest) { if (updateFilterRequest == null) { return(BuildMissingParameter(nameof(updateFilterRequest))); } IActionResult errorResult = null; if (!CheckParameter(updateFilterRequest, out errorResult)) { return(errorResult); } var filter = await _filterRepository.Get(updateFilterRequest.Id); if (filter == null) { return(new StatusCodeResult((int)HttpStatusCode.NotFound)); } await _filterRepository.Update(updateFilterRequest.ToParameter()); return(new NoContentResult()); }
public void Insert(ChallengeFilterDto challengeFilterDto) { var invite = _inviteRepository.Find(x => x.ChallengeId == challengeFilterDto.Id && x.UserId == Guid.Parse("8268c85c-6355-4ebd-b498-0d1a8839e052")) .FirstOrDefault(); if (invite == null) { return; } foreach (var filter in challengeFilterDto.Filters) { filter.InviteId = invite.Id; var tmpIdea = _filterRepository.GetById(filter.Id); if (tmpIdea == null) { _filterRepository.Add(filter); } else { tmpIdea.Title = filter.Title; tmpIdea.Description = filter.Description; _filterRepository.Update(tmpIdea); } } var challenge = _challengeRepository.GetById(challengeFilterDto.Id); if (challenge.ChallengeState == 3) { challenge.ChallengeState += 1; } }