Ejemplo n.º 1
0
 public T Update(T entity)
 {
     NullCheck(entity);
     _context.Update(entity);
     _context.SaveChanges();
     return(entity);
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(string id, [Bind("FullName,Phone,Email,Company,Status,Id,DateCreated,CreatedBy")] Customer customer)
        {
            if (id != customer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Ejemplo n.º 3
0
        protected static void updateAccount(string name1, string name2)
        {
            AccountEntity account = getAccount(name1);

            account.Name = name2;
            context.Update <AccountEntity>(account);
            context.SaveChanges();
        }
Ejemplo n.º 4
0
 public void Update(Usuario obj)
 {
     Db.Update(obj);
     Db.SaveChanges();
 }