コード例 #1
0
        public async Task <IActionResult> PutEndSavingWallet([FromRoute] int id, [FromBody] EndSavingWallet endSavingWallet)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != endSavingWallet.id_end)
            {
                return(BadRequest());
            }

            _context.Entry(endSavingWallet).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EndSavingWalletExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PostEndSavingWallet([FromBody] EndSavingWallet endSavingWallet)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.EndSavingWallet.Add(endSavingWallet);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEndSavingWallet", new { id = endSavingWallet.id_end }, endSavingWallet));
        }