Ejemplo n.º 1
0
        public async Task <ActionResult <RevenueCentre> > PostRevenueCentre(RevenueCentre revenueCentre)
        {
            _context.RevenueCentres.Add(revenueCentre);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetRevenueCentre", new { id = revenueCentre.Id }, revenueCentre));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutRevenueCentre(int id, RevenueCentre revenueCentre)
        {
            if (id != revenueCentre.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }