Exemplo n.º 1
0
        public IHttpActionResult PostCreateRule([FromBody]RuleViewModel data)
        {
            if (!ModelState.IsValid)
                return BadRequest();

            var rule = new Rule()
            {
                Name = data.Name,
                RuleDefinition = data.RuleDefinition
            };
            _gameOfDronesRepository.AddRule(rule);
            _gameOfDronesRepository.SaveChanges();
            return Ok(rule);
        }
 public void AddRule(Rule rule)
 {
     _ctx.Rules.Add(rule);
 }