Ejemplo n.º 1
0
 //Remove a payeer or payer from the database based on the id
 public bool RemovePayerPayee(int id)
 {
     using (var context = new FinanceEDMContainer())
     {
         var record = context.PayerPayees.Where(e => e.PPId == id).Single();
         context.PayerPayees.Remove(record);
         context.SaveChanges();
     }
     return(true);
 }
Ejemplo n.º 2
0
 //remove a transaction by id
 public bool RemoveTransaction(int id)
 {
     using (var context = new FinanceEDMContainer())
     {
         var remove = context.Transactions.Where(e => e.TransactionId == id).Single();
         context.Transactions.Remove(remove);
         context.SaveChanges();
     }
     return(true);
 }
Ejemplo n.º 3
0
 //add a payer or payee to the database
 public bool AddPayerPayee(PayerPayee obj)
 {
     using (var context = new FinanceEDMContainer())
     {
         //obj.UserDetailsUserId = Session.SessionID;
         obj.UserDetailsUserId = 1;
         context.PayerPayees.Add(obj);
         context.SaveChanges();
     }
     return(true);
 }
Ejemplo n.º 4
0
 //Add a transaction to the database
 public bool AddTransaction(List <Transaction> obj)
 {
     using (var context = new FinanceEDMContainer())
     {
         foreach (Transaction item in obj)
         {
             context.Transactions.Add(item);
             context.SaveChanges();
         }
     }
     return(true);
 }
Ejemplo n.º 5
0
 //update a payer or payee based on the id
 public bool UpdatePayerPayee(PayerPayee obj)
 {
     using (var context = new FinanceEDMContainer())
     {
         var record = context.PayerPayees.SingleOrDefault(e => e.PPId == obj.PPId);
         record.Name    = obj.Name;
         record.Address = obj.Address;
         record.DOB     = obj.DOB;
         record.Email   = obj.Email;
         //obj.UserDetailsUserId = Session.SessionID;
         record.UserDetailsUserId = 1;
         context.SaveChanges();
     }
     return(true);
 }
Ejemplo n.º 6
0
 //update the transaction fields
 public bool UpdateTransaction(Transaction obj)
 {
     using (var context = new FinanceEDMContainer())
     {
         var record = context.Transactions.SingleOrDefault(e => e.TransactionId == obj.TransactionId);
         record.Category        = obj.Category;
         record.Date            = obj.Date;
         record.Description     = obj.Description;
         record.PayerPayeePPId  = obj.PayerPayeePPId;
         record.Recuring        = obj.Recuring;
         record.TransactionId   = obj.TransactionId;
         record.TransactionType = obj.TransactionType;
         context.SaveChanges();
     }
     return(true);
 }
Ejemplo n.º 7
0
 //register new user
 public bool AddUser(UserDetails obj)
 {
     using (var context = new FinanceEDMContainer())
     {
         var userRecord = context.UserDetails.Where(e => e.Email == obj.Email);
         if (userRecord.Any())
         {
             return(false);
         }
         else
         {
             context.UserDetails.Add(obj);
             context.SaveChanges();
         }
     }
     return(true);
 }