示例#1
0
        public void Delete(int id)
        {
            using (var ctx = new Context.Context())
            {
                var usuario = ctx.Usuarios.Find(id);

                if (usuario != null)
                {
                    usuario.ConfirmacaoSenha = usuario.Senha;
                    usuario.DataExclusao     = DateTime.Now;

                    ctx.Entry(usuario).State = System.Data.Entity.EntityState.Modified;
                    ctx.SaveChanges();

                    var responsavel = ctx.Responsaveis.Where(x => x.DataExclusao == null && x.UsuarioID == usuario.ID).SingleOrDefault();

                    if (responsavel != null)
                    {
                        responsavel.UsuarioID = null;

                        ctx.Entry(responsavel).State = System.Data.Entity.EntityState.Modified;
                        ctx.SaveChanges();
                    }
                }
            }
        }
示例#2
0
 public virtual void Delete(TEntity entityToDelete)
 {
     if (_context.Entry(entityToDelete).State == EntityState.Detached)
     {
         _dbSet.Attach(entityToDelete);
     }
     _context.Entry(entityToDelete).State = EntityState.Deleted;
     _dbSet.Remove(entityToDelete);
 }
示例#3
0
        public async Task <TEntity> Update(TEntity entity)
        {
            _context.Entry(entity).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(entity);
        }
示例#4
0
        public void Update(int perfilID, string funcionalidade, string metodo)
        {
            using (var ctx = new Context.Context())
            {
                var permissoes = ctx.Permissoes.Where(x => x.PerfilID == perfilID).ToList();

                var permissao = permissoes.Where(x => x.Funcionalidade.Nome.ToLower() == funcionalidade.ToLower() && x.Metodos.ToLower().Contains(metodo.ToLower())).FirstOrDefault();

                List <string> metodos = permissao.Metodos.Split(',').ToList();

                if (permissao == null)
                {
                    metodos.Add(metodo.ToUpper());
                }
                else
                {
                    metodos = metodos.Where(x => x != metodo.ToUpper()).ToList();
                }

                permissao.Metodos = string.Join(",", metodos);

                ctx.Entry(permissao).State = System.Data.Entity.EntityState.Modified;
                ctx.SaveChanges();
            }
        }
示例#5
0
 public void Update(Placa placa)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(placa).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#6
0
 public void Update(OrdemServico ordemServico)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(ordemServico).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#7
0
 public void Update(PropriedadeValor propriedadeValor)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(propriedadeValor).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#8
0
 public void Update(Sincronizacao sincronizacao)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(sincronizacao).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#9
0
 public void Update(Filial filial)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(filial).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#10
0
 public void Update(InventarioConfig config)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(config).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#11
0
 public void Update(Upload upload)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(upload).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#12
0
 public void Update(CentroCusto centroCusto)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(centroCusto).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#13
0
 public void Update(Responsavel resp)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(resp).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#14
0
 public void Update(Especie especie)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(especie).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#15
0
 public void Update(Coletor coletor)
 {
     using (var ctx = new Context.Context())
     {
         ctx.Entry(coletor).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
示例#16
0
 public ActionResult Edit([Bind(Include = "RegionId,Nom,Description")] Region region)
 {
     if (ModelState.IsValid)
     {
         db.Entry(region).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(region));
 }
示例#17
0
        public T Edit(T myObj)
        {
            if (!IsAttached(myObj))
            {
                var obj = DbSet.Attach(myObj);
                myObj = obj;
            }

            Db.Entry(myObj).State = EntityState.Modified;

            return(myObj);
        }
示例#18
0
        public void Delete(int id)
        {
            using (var ctx = new Context.Context())
            {
                var especie = ctx.Especies.Find(id);

                if (especie != null)
                {
                    especie.DataExclusao = DateTime.Now;

                    ctx.Entry(especie).State = System.Data.Entity.EntityState.Modified;
                    ctx.SaveChanges();
                }
            }
        }
示例#19
0
        public void Delete(int id)
        {
            using (var ctx = new Context.Context())
            {
                var centroCusto = ctx.CentrosCusto.Find(id);

                if (centroCusto != null)
                {
                    centroCusto.DataExclusao = DateTime.Now;

                    ctx.Entry(centroCusto).State = System.Data.Entity.EntityState.Modified;
                    ctx.SaveChanges();
                }
            }
        }
示例#20
0
        public void Delete(int id)
        {
            using (var ctx = new Context.Context())
            {
                var coletor = ctx.Coletores.Find(id);

                if (coletor != null)
                {
                    coletor.DataExclusao = DateTime.Now;

                    ctx.Entry(coletor).State = System.Data.Entity.EntityState.Modified;
                    ctx.SaveChanges();
                }
            }
        }
示例#21
0
        public void Delete(int id)
        {
            using (var ctx = new Context.Context())
            {
                var filial = ctx.Filiais.Find(id);

                if (filial != null)
                {
                    filial.DataExclusao = DateTime.Now;

                    ctx.Entry(filial).State = System.Data.Entity.EntityState.Modified;
                    ctx.SaveChanges();
                }
            }
        }
示例#22
0
        public void Delete(int id)
        {
            using (var ctx = new Context.Context())
            {
                var resp = ctx.PropriedadeValores.Find(id);

                if (resp != null)
                {
                    resp.DataExclusao = DateTime.Now;

                    ctx.Entry(resp).State = System.Data.Entity.EntityState.Modified;
                    ctx.SaveChanges();
                }
            }
        }
示例#23
0
        public void Delete(int id)
        {
            using (var ctx = new Context.Context())
            {
                var inventarioUsuario = ctx.InventarioUsuarios.Find(id);

                if (inventarioUsuario != null)
                {
                    inventarioUsuario.DataExclusao = DateTime.Now;

                    ctx.Entry(inventarioUsuario).State = System.Data.Entity.EntityState.Modified;
                    ctx.SaveChanges();
                }
            }
        }
示例#24
0
        public void Delete(int id)
        {
            using (var ctx = new Context.Context())
            {
                var grupo = ctx.Grupos.Find(id);

                if (grupo != null)
                {
                    grupo.DataExclusao = DateTime.Now;

                    ctx.Entry(grupo).State = System.Data.Entity.EntityState.Modified;
                    ctx.SaveChanges();
                }
            }
        }
示例#25
0
        public void Delete(int id)
        {
            using (var ctx = new Context.Context())
            {
                var placa = ctx.Placas.Find(id);

                if (placa != null)
                {
                    placa.DataExclusao = DateTime.Now;
                }

                ctx.Entry(placa).State = System.Data.Entity.EntityState.Modified;
                ctx.SaveChanges();
            }
        }
示例#26
0
        public void Delete(int id)
        {
            using (var ctx = new Context.Context())
            {
                var item = ctx.Itens.Find(id);

                if (item != null)
                {
                    item.DataExclusao = DateTime.Now;

                    ctx.Entry(item).State = System.Data.Entity.EntityState.Modified;
                    ctx.SaveChanges();
                }
            }
        }
示例#27
0
        public async Task <T> UpdateAsync(T item)
        {
            try
            {
                var result = await _dataSet.SingleOrDefaultAsync(c => c.Id.Equals(item.Id));

                if (result == null)
                {
                    return(null);
                }

                item.UpdateAt = DateTime.UtcNow;
                item.CreateAt = result.CreateAt;

                _context.Entry(result).CurrentValues.SetValues(item);
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(item);
        }
示例#28
0
 public void UpdateArtist(Artists artist)
 {
     context.Entry(artist).State = EntityState.Modified;
 }
 public void UpdateAppLogs(AppLogs log)
 {
     context.Entry(log).State = EntityState.Modified;
 }
 public void Update(TEntity entity)
 {
     ctx.Entry(entity).State = System.Data.Entity.EntityState.Modified;
 }