public BillEnergy GetTheBillMin()
        {
            List <BillEnergy> contas   = GetAll();
            DateTime          zeroZero = new DateTime(2000, 01, 01);

            if (contas.Count == 0)
            {
                BillEnergy contaVazia = new BillEnergy(0, zeroZero, 0, 0, 0.0, zeroZero, 0);
                return(contaVazia);
            }
            else
            {
                var theMaxBill = contas.Min(x => x.kwSpent);
                return(contas.Where(x => x.kwSpent == theMaxBill).FirstOrDefault());
            }
        }
 public void Update(BillEnergy bill)
 {
     context.Entry(bill).State = EntityState.Modified;
     context.SaveChanges();
 }
 public void Save(BillEnergy bill)
 {
     context.Bills.Add(bill);
     context.SaveChanges();
 }