Example #1
0
 public void UpdateMember(MemberView mv)
 {
     using (GoGoDBEntities db = new GoGoDBEntities())
     {
         Member mm = db.Members.Find(mv.id_member);
         mm.nama    = mv.nama;
         mm.telepon = mv.telepon;
         mm.saldo   = mv.saldo;
         //db.Members.Add(mm);
         db.SaveChanges();
     }
 }
Example #2
0
 public void AddMember(MemberView mv)
 {
     using (GoGoDBEntities db = new GoGoDBEntities())
     {
         Member mm = new Member();
         mm.nama    = mv.nama;
         mm.telepon = mv.telepon;
         mm.saldo   = mv.saldo;
         db.Members.Add(mm);
         db.SaveChanges();
     }
 }
Example #3
0
        public void DeleteMember(int memberID)
        {
            using (GoGoDBEntities db = new GoGoDBEntities())
            {
                using (var dbContextTransaction = db.Database.BeginTransaction())
                {
                    try
                    {
                        var mm = db.Members.Where(o => o.id_member == memberID);
                        if (mm.Any())
                        {
                            db.Members.Remove(mm.FirstOrDefault());
                            db.SaveChanges();
                        }

                        dbContextTransaction.Commit();
                    }
                    catch
                    {
                        dbContextTransaction.Rollback();
                    }
                }
            }
        }