public async Task <ActionResult <Productsdetail> > PostProductsdetail(Productsdetail productsdetail)
        {
            _context.Productsdetail.Add(productsdetail);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetProductsdetail", new { id = productsdetail.Id }, productsdetail));
        }
        public async Task <IActionResult> PutProductsdetail(Guid id, Productsdetail productsdetail)
        {
            if (id != productsdetail.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 3
0
        public async Task <IActionResult> PostProductsdetail([FromBody] Productsdetail productsdetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Productsdetail.Add(productsdetail);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ProductsdetailExists(productsdetail.Id))
                {
                    return(new StatusCodeResult(StatusCodes.Status409Conflict));
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetProductsdetail", new { id = productsdetail.Id }, productsdetail));
        }
Esempio n. 4
0
        public async Task <ActionResult <Productsdetail> > PostProductsdetail(Productsdetail productsdetail)
        {
            _context.Productsdetail.Add(productsdetail);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ProductsdetailExists(productsdetail.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetProductsdetail", new { id = productsdetail.Id }, productsdetail));
        }