コード例 #1
0
        public member GetClass(int id)
        {
            var db     = new FamilyMembersManagementEntities();
            var @class = db.members.Find(id);

            return(@class);
        }
コード例 #2
0
        public member[] GetClasses()
        {
            var db      = new FamilyMembersManagementEntities();
            var classes = db.members.ToArray();

            return(classes);
        }
コード例 #3
0
        public void DeleteClass(int id)
        {
            var db     = new FamilyMembersManagementEntities();
            var @class = db.members.Find(id);

            db.members.Remove(@class);
            db.SaveChanges();
        }
コード例 #4
0
        public void EditClass(int id, string fullname, string hometown, string currentliving, string occupation)
        {
            var db       = new FamilyMembersManagementEntities();
            var oldClass = db.members.Find(id);

            oldClass.fullname   = fullname;
            oldClass.hometown   = hometown;
            oldClass.living     = currentliving;
            oldClass.occupation = occupation;

            db.Entry(oldClass).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
コード例 #5
0
        public void AddClass(string fullname, string hometown, string currentliving, string occupation)
        {
            var newClass = new member();

            newClass.fullname   = fullname;
            newClass.hometown   = hometown;
            newClass.living     = currentliving;
            newClass.occupation = occupation;

            var db = new FamilyMembersManagementEntities();

            db.members.Add(newClass);
            db.SaveChanges();
        }