public IActionResult CreateFeed([FromBody] FeedDTO input) { if (ModelState.IsValid) { return(Ok(_feedService.AddFeed(input))); } return(BadRequest()); }
public async Task <IActionResult> CreateFeed(FeedDTO model) { var result = await _feedServices.AddFeed(model); if (result.Success) { return(Created("", result)); } return(BadRequest(result)); }
public ActionResult Create(FeedCreateViewModel feedViewModel) { if (!ModelState.IsValid) { return(View(feedViewModel)); } Feed newFeed; try { newFeed = Feed.CreateFeed(feedViewModel.Url); } catch (FeedDataLoadException ex) { ModelState.AddModelError("", ex.Message); return(View(feedViewModel)); } feedService.AddFeed(newFeed); return(RedirectToAction("Index")); }