Esempio n. 1
0
        public async Task <ActionResult <ArticlePurchase> > PostArticlePurchase(ArticlePurchase articlePurchase)
        {
            _context.ArticlePurchases.Add(articlePurchase);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetArticlePurchase", new { id = articlePurchase.Id }, articlePurchase));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutArticlePurchase(int id, ArticlePurchase articlePurchase)
        {
            if (id != articlePurchase.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }