コード例 #1
0
ファイル: UserFamily.cs プロジェクト: bkdiehl/FamilyGroups
 public UserFamilyViewModel(UserFamily userFamily)
 {
     UserId = userFamily.UserId;
     FamilyId = userFamily.FamilyId;
     IsPending = userFamily.IsPending;
     IsAdmin = userFamily.IsAdmin;
 }
コード例 #2
0
 // POST: api/UserFamilies
 public UserFamilyViewModel Post(UserFamily userFamily, string familyId = null, string userId = null)
 {
     UserFamily toUpdate = null;
     if (familyId != null && userId != null) {
         toUpdate.UserId = userFamily.UserId;
         toUpdate.FamilyId = userFamily.FamilyId;
         toUpdate.IsPending = userFamily.IsPending;
         toUpdate.IsAdmin = userFamily.IsAdmin;
     } else db.UserFamilies.Add(userFamily);
     db.SaveChanges();
     return new UserFamilyViewModel(toUpdate ?? userFamily);
 }