public async Task <IActionResult> CreateFeed([FromForm, Required] AddFeedRequest model) { if (!ModelState.IsValid) { _logger.LogInformation("Model state is invalid, returning bad request"); return(BadRequest()); } await _mediator.Send(new CreateFeedRequest(User, model)); return(Redirect("~/profile")); }
public IActionResult AddFeed([FromBody] AddFeedRequest request) { try { int id = repository.AddFeed(request.UserId, request.FeedCollectionId, request.Url); return(StatusCode((int)HttpStatusCode.Created, id)); } catch (Exception e) { Log.Error(e, nameof(AddFeed)); return(StatusCode((int)HttpStatusCode.InternalServerError, $"Add Feed unexpected error. {e.Message}")); } }
public CreateFeedRequest(ClaimsPrincipal user, AddFeedRequest model) { User = user; Model = model; }