示例#1
0
        public async Task <CoinViewModel> AddAsync(CoinCreateModel cm)
        {
            var max = await base.MaxAsync(x => new CoinViewModel {
                Id = x.Id
            });

            cm.Id = (short)(max == null? 1:++max.Id);

            return(await base.AddAsync <CoinCreateModel, CoinViewModel>(cm));
        }
示例#2
0
        public async Task <IActionResult> Post([FromBody] CoinCreateModel cm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var vm = await this.service.AddAsync(cm);

            return(Ok(vm));
        }