Exemplo n.º 1
0
 public Chamado BuscarPorId(int id)
 {
     try
     {
         using (MinhaVozContext ctx = new MinhaVozContext())
         {
             return(ctx.Chamado.Find(id));
         }
     }catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 2
0
 public List <Chamado> Listar()
 {
     try
     {
         using (MinhaVozContext ctx = new MinhaVozContext())
         {
             return(ctx.Chamado.ToList());
         }
     }catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 3
0
 public Dominio.Entidades.Usuario EfetuarLogin(string email, string senha)
 {
     try
     {
         using (MinhaVozContext ctx = new MinhaVozContext())
         {
             return(ctx.Usuario.FirstOrDefault(u => u.Email == email && u.Senha == senha));
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 4
0
 public Chamado Cadastrar(Chamado chamado)
 {
     try
     {
         using (MinhaVozContext ctx = new MinhaVozContext())
         {
             ctx.Chamado.Add(chamado);
             ctx.SaveChanges();
             return(chamado);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 5
0
        public Chamado EditarStatus(Chamado chamado)
        {
            using (MinhaVozContext ctx = new MinhaVozContext())
            {
                Chamado chamadoExiste = ctx.Chamado.Find(chamado.Id);

                if (chamadoExiste != null)
                {
                    chamadoExiste.Status = chamado.Status;
                    ctx.Chamado.Update(chamadoExiste);
                    ctx.SaveChanges();

                    return(chamadoExiste);
                }

                return(null);
            }
        }