Esempio n. 1
0
        public async Task <ActionResult <Apprecier> > PostApprecier([FromBody] String Id, int IdArticle)
        {
            Apprecier apprecier = null;

            apprecier.Id        = Id;
            apprecier.IdArticle = IdArticle;
            _context.Apprecier.Add(apprecier);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ApprecierExists(apprecier.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetApprecier", new { id = apprecier.Id }, apprecier));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutApprecier(string id, Apprecier apprecier)
        {
            if (id != apprecier.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }