コード例 #1
0
        public async Task <IActionResult> Post([FromBody] CoreAppViewModel appModel)
        {
            if (ModelState.IsValid)
            {
                var success = await _coreModelRepo.Add(appModel);

                return(Created($"api/custom/values/{appModel.Title}", appModel));
            }
            return(BadRequest("Failed to save item"));
        }
コード例 #2
0
        public void Add(CoreAppViewModel postModel)
        {
            var coreAppModel = Mapper.Map <CoreAppModel>(postModel);

            _context.CoreAppModels.Add(coreAppModel);
        }