Beispiel #1
0
        public List <Veiculo> getVeiculosCor(string cor)
        {
            List <Veiculo> list;

            using (solutionAppEntities context = new solutionAppEntities())
            {
                var query =
                    from veiculo in context.Veiculo
                    where veiculo.cor == cor
                    select veiculo;

                list = query.ToList();
            }

            return(list);
        }
Beispiel #2
0
        public IHttpActionResult deleteVeiculo(int id)
        {
            if (id <= 0)
            {
                return(BadRequest("Not a valid student id"));
            }

            using (var ctx = new solutionAppEntities())
            {
                var veiculo = ctx.Veiculo
                              .Where(s => s.id == id)
                              .FirstOrDefault();

                ctx.Entry(veiculo).State = System.Data.Entity.EntityState.Deleted;
                ctx.SaveChanges();
            }

            return(Ok());
        }