Ejemplo n.º 1
0
        public async Task <IActionResult> PutCustomerMotorcycle(int id, CustomerMotorcycle customerMotorcycle)
        {
            if (id != customerMotorcycle.CustomerMotorcycleId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <CustomerMotorcycle> > PostCustomerMotorcycle(CustomerMotorcycle customerMotorcycle)
        {
            _context.CustomerMotorcycles.Add(customerMotorcycle);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCustomerMotorcycle", new { id = customerMotorcycle.CustomerMotorcycleId }, customerMotorcycle));
        }