Exemplo n.º 1
0
        public async Task <IActionResult> PutPromotionalAgencies(int id, PromotionalAgencies promotionalAgencies)
        {
            promotionalAgencies.Id = id;
            if (id <= 0)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <PromotionalAgencies> > PostPromotionalAgencies(PromotionalAgencies promotionalAgencies)
        {
            _context.PromotionalAgencies.Add(promotionalAgencies);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPromotionalAgencies", new { id = promotionalAgencies.Id }, promotionalAgencies));
        }