コード例 #1
0
        public StatusCodeResult Create([FromBody] Beacon beacon)
        {
            if (!ModelState.IsValid)
            {
                return(StatusCode(422));
            }

            _dataAccessProvider.Create(beacon, DatabaseConfiguration.BeaconsEntity);
            return(StatusCode(201));
        }
コード例 #2
0
        public StatusCodeResult Create([FromBody] Consumable consumable)
        {
            if (!ModelState.IsValid)
            {
                return(StatusCode(422));
            }

            _dataAccessProvider.Create(consumable, DatabaseConfiguration.ConsumableEntity);
            return(StatusCode(201));
        }
コード例 #3
0
        public StatusCodeResult Create([FromBody] Intake intake)
        {
            if (!ModelState.IsValid)
            {
                return(StatusCode(422));
            }

            if (!_dataAccessProvider.Exists <User>(new ObjectId(intake.UserId), DatabaseConfiguration.UsersEntity))
            {
                return(StatusCode(406));
            }

            _dataAccessProvider.Create(intake, DatabaseConfiguration.IntakeEntity);
            return(StatusCode(201));
        }