Beispiel #1
0
        public async Task <ActionResult> PutLink(int id, Link link)
        {
            if (id != link.ID)
            {
                return(NotFound());
            }

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

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

                return(Conflict());
            }

            return(NoContent());
        }
Beispiel #2
0
        public async Task CreateAsync(TEntity entity)
        {
            await _entities.AddAsync(entity);

            await _dbContext.SaveChangesAsync();
        }