コード例 #1
0
ファイル: LevelController.cs プロジェクト: martineeka/Sample
        public IActionResult Put([FromBody] CreateEditViewModel model)
        {
            DataClaim.GetClaim(Request);
            if (model == null)
            {
                return(BadRequest("Level is null."));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var decryptedID = Convert.ToInt32(EncryptionHelper.DecryptUrlParam(model.ID));

            model.ID = decryptedID.ToString();
            var level = _levelProvider.Get(Convert.ToInt32(model.ID));

            var levelMapper = _mapper.Map(model, level);

            _levelProvider.Edit(levelMapper);
            return(Ok());
        }