Exemplo n.º 1
0
        public async Task <IActionResult> PutcatCharge(string id, catCharge catCharge)
        {
            if (id != catCharge.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <catCharge> > PostcatCharge(catCharge catCharge)
        {
            _context.catCharge.Add(catCharge);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (catChargeExists(catCharge.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetcatCharge", new { id = catCharge.ID }, catCharge));
        }