Exemplo n.º 1
0
        public async Task <IActionResult> Putbusiness_sources([FromRoute] int id, [FromBody] business_sources business_sources)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != business_sources.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Postbusiness_sources([FromBody] business_sources business_sources)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.business_sources.Add(business_sources);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getbusiness_sources", new { id = business_sources.id }, business_sources));
        }