Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Price,Id")] Bid bid, int propId)
        {
            if (id != bid.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var prop = await _context.ThematicProps.SingleOrDefaultAsync(m => m.Id == propId);

                    bid.ThematicPropId        = prop.Id;
                    _context.Entry(bid).State = EntityState.Modified;
                    await _context.SaveChangesAsync();

                    UpdateThematicProp(prop);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BidExists(bid.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bid));
        }
Пример #2
0
        public void Update(T entity)
        {
            IsEntityNull(entity);

            //_entities.Attach(entity);
            _context.Entry(entity).State = EntityState.Modified;

            Save();
        }