Beispiel #1
0
        public void AddBranchForUser(UserModel user, BranchModel branch)
        {
            var count = user_has_branch_coll.Where(uhb => uhb.username == user && uhb.branch_name == branch);

            if (count.Count() == 0)
            {
                UserHasBranchModel userHasBranch = new UserHasBranchModel(Session.DefaultSession)
                {
                    username    = user,
                    branch_name = branch
                };
                userHasBranch.Save();
            }
        }
Beispiel #2
0
        public void RemoveBranchFromUser(UserModel user, BranchModel branch)
        {
            UserHasBranchModel userHasBranch = user_has_branch_coll.FirstOrDefault(uhb => uhb.username == user && uhb.branch_name == branch);

            userHasBranch.Delete();
        }