Exemple #1
0
            public async Task <Result> Handle(CreateFeedCommand command)
            {
                var feedResult = Feed.Create(command.Id, command.Name);

                if (feedResult.IsFailure)
                {
                    return(Result.Fail(feedResult.Error));
                }
                await _feedRepository.Add(feedResult.Value);

                await _feedRepository.UnitOfWork.SaveChangesAsync();

                return(Result.Ok());
            }
Exemple #2
0
        public async Task <Response <FeedReadDto> > AddFeed(FeedDTO model)
        {
            var response = new Response <FeedReadDto>();
            var category = FeedProfile.FeedDtoToFeedMapper(model);

            if (await _feedRepo.Add(category))
            {
                var feedDto = FeedProfile.FeedToFeedReadDtoMapper(category);
                response.Success = true;
                response.Message = "category created successfully";
                response.Data    = feedDto;
                return(response);
            }

            response.Message = "category failed to add";
            return(response);
        }
Exemple #3
0
        private Feed Create(FeedViewModel item)
        {
            Feed t = new Feed
            {
                Title       = item.Title,
                Description = item.Description,
                Address     = item.Address,
                //ModuleId = ActiveModule.ModuleID,
                CreatedByUserId      = UserInfo.UserID,
                LastModifiedByUserId = UserInfo.UserID,
                CreatedOnDate        = DateTime.UtcNow,
                LastModifiedOnDate   = DateTime.UtcNow
            };

            _repository.Add(t);

            return(t);
        }
Exemple #4
0
 public void NavigateTo(string searchValue)
 {
     feedRepository.Add(new Uri(searchValue));
 }
Exemple #5
0
 public ApiResponse <Feed> Insert([FromBody] Feed feed)
 {
     return(_feedRepository.Add(feed));
 }