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

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

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PostCustomerReviewTbl([FromBody] CustomerReviewTbl customerReviewTbl)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.CustomerReviewTbl.Add(customerReviewTbl);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCustomerReviewTbl", new { id = customerReviewTbl.Id }, customerReviewTbl));
        }