Exemple #1
0
        public static int CreateFamily()
        {
            var user = UserSession.Current.User;

            if (user != null)
            {
                var    repo   = new FamilyRepository();
                Family family = new Family()
                {
                    OwnerCode = user.Code
                };

                var code = repo.InsertData(family);
                if (code > Constants.DEFAULT_CODE)
                {
                    user.FamilyCode = code;
                    user.StatusCode = (int)Constants.StatusUser.Admin;
                    var userRepo = new UserRepository((int)Constants.UserAction.Code);
                    userRepo.UpdateUserData(user.Code, user, new List <int>()
                    {
                        (int)Constants.UserField.FamilyCode, (int)Constants.UserField.StatusCode
                    });
                    return(code);
                }
            }
            throw new NotImplementedException();
        }