public IActionResult Index(Feed feed) { var result = new Result(); var feedInfo = _feedService.Create(feed); return(Ok(result)); }
public ActionResult Create(Feed feed) { try { // TODO: Add insert logic here _feedService.Create(feed); return(RedirectToAction(nameof(Index))); } catch { return(View(feed)); } }
public async void Create() { var mock = new ServiceMockFacade <IFeedRepository>(); var model = new ApiFeedRequestModel(); mock.RepositoryMock.Setup(x => x.Create(It.IsAny <Feed>())).Returns(Task.FromResult(new Feed())); var service = new FeedService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.FeedModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLFeedMapperMock, mock.DALMapperMockFactory.DALFeedMapperMock); CreateResponse <ApiFeedResponseModel> response = await service.Create(model); response.Should().NotBeNull(); mock.ModelValidatorMockFactory.FeedModelValidatorMock.Verify(x => x.ValidateCreateAsync(It.IsAny <ApiFeedRequestModel>())); mock.RepositoryMock.Verify(x => x.Create(It.IsAny <Feed>())); }
public ActionResult <Feed> Create(Feed feed) { _feedService.Create(feed); return(CreatedAtRoute("GetFeed", new { id = feed.FeedID.ToString() }, feed)); }