Example #1
0
        protected void Delete <ModelType>(Guid id) where ModelType : ModelBase
        {
            ModelType model = _context.Set <ModelType>().SingleOrDefault(m => m.Id == id && m.Ativo);

            model.Ativo = false;
            _context.SaveChanges();
        }
        // GET: Veiculoes/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var veiculo = await _context.Veiculo.FindAsync(id);

            if (veiculo == null)
            {
                return(NotFound());
            }
            ViewData["Empresa_Id"] = new SelectList(_context.Set <Empresa>(), "Id", "nome", veiculo.Empresa_Id);
            return(View(veiculo));
        }