예제 #1
0
        public IActionResult Index(Feed feed)
        {
            var result = new Result();

            var feedInfo = _feedService.Create(feed);

            return(Ok(result));
        }
예제 #2
0
 public ActionResult Create(Feed feed)
 {
     try
     {
         // TODO: Add insert logic here
         _feedService.Create(feed);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View(feed));
     }
 }
예제 #3
0
        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>()));
        }
예제 #4
0
        public ActionResult <Feed> Create(Feed feed)
        {
            _feedService.Create(feed);

            return(CreatedAtRoute("GetFeed", new { id = feed.FeedID.ToString() }, feed));
        }