Exemple #1
0
        public void EditContact(int id, String name)
        {
            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            Contact contact = db.Contacts.Find(id);

            contact.Name = name;
            db.SaveChanges();
        }
Exemple #2
0
        public void DeleteContact(int id)
        {
            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            Contact contact = db.Contacts.Find(id);

            db.Contacts.Remove(contact);
            db.SaveChanges();
        }
        public void DeleteEvent(int id)
        {
            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            Event eventData = db.Events.Find(id);

            db.Events.Remove(eventData);
            db.SaveChanges();
        }
Exemple #4
0
        public void DeleteTransaction(int id)
        {
            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            Transaction transaction = db.Transactions.Find(id);

            db.Transactions.Remove(transaction);
            db.SaveChanges();
        }
Exemple #5
0
        public void EditTransaction(TransactionDetails transactionDetails)
        {
            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            Transaction transaction = db.Transactions.Find(transactionDetails.Id);

            transaction.Date      = transactionDetails.Date;
            transaction.ContactId = transactionDetails.ContactId;
            transaction.Amount    = transactionDetails.Amount;

            db.SaveChanges();
        }
Exemple #6
0
        public void SaveContact(ContactDetails contactDetails)
        {
            Contact contact = new Contact();

            contact.Type = contactDetails.Type;

            contact.Name = contactDetails.Name;

            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            db.Contacts.Add(contact);
            db.SaveChanges();
        }
Exemple #7
0
        public void SaveTransaction(TransactionDetails transactionDetails)
        {
            Transaction transaction = new Transaction();

            transaction.Date      = transactionDetails.Date;
            transaction.Type      = transactionDetails.Type;
            transaction.ContactId = transactionDetails.ContactId;
            transaction.Amount    = transactionDetails.Amount;

            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            db.Transactions.Add(transaction);
            db.SaveChanges();
        }
        public void EditEvent(EventDetails eventDetails)
        {
            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            Event eventData = db.Events.Find(eventDetails.Id);

            eventData.OccurrenceType      = eventDetails.OccurrenceType;
            eventData.StartDate           = eventDetails.StartDate;
            eventData.AdditionalRecurring = eventDetails.AdditionalRecurring;
            eventData.Description         = eventDetails.Description;
            eventData.EventType           = eventDetails.EventType;

            db.SaveChanges();
        }
Exemple #9
0
        public dynamic GetContact()
        {
            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            return(db.Contacts);
        }
Exemple #10
0
        public dynamic GetTransaction()
        {
            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            return(db.Transactions);
        }
        public dynamic GetEvent()
        {
            MyDatabaseFileEntities db = new MyDatabaseFileEntities();

            return(db.Events);
        }