Exemple #1
0
        public async Task <IActionResult> PutOrder(int id, Order item)
        {
            if (id != item.OrderId)
            {
                return(BadRequest());
            }

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

            await _context.SaveChangesAsync();

            return(NoContent());
        }
        /// <summary>
        ///     Update entity
        /// </summary>
        /// <param name="entity">Entity</param>
        public T Update(T entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            var updateEntity = _context.Entry(entity);

            updateEntity.State = EntityState.Modified;
            _context.SaveChanges();
            return(updateEntity.Entity);
        }
 public void Update(Customers customer)
 {
     _context.Entry(customer).State = EntityState.Modified;
     _context.SaveChanges();
 }
Exemple #4
0
 public void Update(Products product)
 {
     _context.Entry(product).State = EntityState.Modified;
     _context.SaveChangesAsync();
 }
 public void Update(Database.Models.Products product)
 {
     _context.Entry(product).State = EntityState.Modified;
     _context.SaveChanges();
 }
Exemple #6
0
 public int Update(Product session)
 {
     _context.Entry(session).State = EntityState.Modified;
     return(_context.SaveChanges());
 }