示例#1
0
        public async Task <Trend> AddTrend(CreateTrendRequest createTrendRequest)
        {
            var trend = new Trend
            {
                Id           = Guid.NewGuid(),
                Name         = createTrendRequest.Name,
                Interval     = createTrendRequest.Interval,
                Type         = createTrendRequest.Type,
                DateCreated  = createTrendRequest.DateCreated,
                TimeOut      = createTrendRequest.TimeOut,
                TreadsNumber = createTrendRequest.TreadsNumber
            };

            _MarketPlaceContext.Trends.Add(trend);
            await _MarketPlaceContext.SaveChangesAsync();

            return(trend);
        }
示例#2
0
        public async Task <IActionResult> AddTrend([FromBody] CreateTrendRequest createTrendRequest)
        {
            var trend = await _trendsService.AddTrend(createTrendRequest);

            return(Ok(TrendDto.Map(trend)));
        }