コード例 #1
0
        internal void Seed()
        {
            var myEntities = new MyEntity[]
            {
                new MyEntity()
                {
                    Name = "MyEntity 1"
                },
                new MyEntity()
                {
                    Name = "MyEntity 2"
                },
                new MyEntity()
                {
                    Name = "MyEntity 3"
                }
            };

            foreach (var myEntity in myEntities)
            {
                _myService.Create(myEntity.Name);
            }
            _output.WriteLine($"{myEntities.Length} entities have been created.");
        }
コード例 #2
0
 public IActionResult Create([FromBody] MyEntity myEntity)
 {
     return(new ObjectResult(_myService.Create(myEntity.Name)));
 }