コード例 #1
0
        public async Task <bool> createCastle(Castle.ViewModels.CastleRequest castle)
        {
            var newCastle = new Castle.Data.Castle
            {
                Name      = castle.Name,
                Location  = castle.Location,
                FileName  = castle.FileName,
                Country   = castle.Country,
                DateBuilt = castle.DateBuilt
            };

            this.ctx.Castles.Add(newCastle);

            return(await Task.FromResult(this.ctx.SaveChanges() == 1));
        }
コード例 #2
0
        public async Task <ActionResult> Post([FromBody] Castle.ViewModels.CastleRequest meta)
        {
            var result = await _castleService.createCastle(meta);

            return(Ok(result));
        }