Example #1
0
        public async Task <IActionResult> PutVehiclebrand(int id, Vehiclebrand vehiclebrand)
        {
            if (id != vehiclebrand.Id)
            {
                return(BadRequest());
            }

            dbContext.Entry(vehiclebrand).State = EntityState.Modified;

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

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <Vehiclebrand> > PostVehiclebrand(Vehiclebrand vehiclebrand)
        {
            dbContext.Vehiclebrand.Add(vehiclebrand);
            try
            {
                await dbContext.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (VehiclebrandExists(vehiclebrand.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetVehiclebrand", new { id = vehiclebrand.Id }, vehiclebrand));
        }