Exemplo n.º 1
0
        public ActionResult <Fact> Create([FromBody] FactDTO dto)
        {
            if (dto.Title == null || dto.Content == null)
            {
                return(ValidationProblem());
            }
            var fact = new Fact(dto.Title, dto.Content);

            _repository.Add(fact);

            return(Ok(fact));
        }
Exemplo n.º 2
0
        public override IEnumerable <Row> Execute(IEnumerable <Row> rows)
        {
            using (var conn = new NpgsqlConnection(conString))
            {
                conn.Open();
                Parallel.ForEach(rows, (row) =>
                {
                    FactRepository.Add(conn, row, _dictAirline, _dictAirport, _dictCity, _dictState, _dictTail);
                });

                foreach (var row in rows)
                {
                    yield return(row);
                }
            }
        }