Ejemplo n.º 1
0
        public ActionResult Edit(AppUserEditView model)
        {
            if (ModelState.IsValid)
            {
                if (Request.Form["submitbutton"] != null)
                {
                    AppUserHelpers.UpdateAppUserFromAppUserEditView(db, model);
                    return(RedirectToAction(model.CallingAction, model.CallingController));
                }

                return(RedirectToAction("Edit"));
            }

            Branch userBranch = BranchHelpers.GetCurrentBranchForUser(AppUserHelpers.GetGuidFromUserGetAppUserId(User.Identity.GetAppUserId()));

            //DropDowns
            ViewBag.BranchList       = ControlHelpers.AllBranchesForCompanyListDropDown(userBranch.CompanyId, userBranch.BranchId);
            ViewBag.UserRoleList     = ControlHelpers.UserRoleEnumListDropDown();
            ViewBag.EntityStatusList = ControlHelpers.EntityStatusEnumListDropDown();

            //Counters
            if (model.UserFriendListView == null)
            {
                model.UserFriendListView = new List <FriendView>();
            }
            if (model.UserBranchFriendListView == null)
            {
                model.UserBranchFriendListView = new List <FriendView>();
            }
            if (model.UserCompanyFriendListView == null)
            {
                model.UserCompanyFriendListView = new List <FriendView>();
            }

            ViewBag.UserFriendCount        = model.UserFriendListView.Count();
            ViewBag.UserBranchFriendCount  = model.UserBranchFriendListView.Count();
            ViewBag.UserCompanyFriendCount = model.UserCompanyFriendListView.Count();

            if (model.UserBlockListView == null)
            {
                model.UserBlockListView = new List <BlockView>();
            }
            if (model.UserBranchBlockListView == null)
            {
                model.UserBranchBlockListView = new List <BlockView>();
            }
            if (model.UserCompanyBlockListView == null)
            {
                model.UserCompanyBlockListView = new List <BlockView>();
            }

            ViewBag.UserBlockCount        = model.UserBlockListView.Count();
            ViewBag.UserBranchBlockCount  = model.UserBranchBlockListView.Count();
            ViewBag.UserCompanyBlockCount = model.UserCompanyBlockListView.Count();

            //rebuild group model
            model.GroupListViewsForUserOnly = GroupViewHelpers.GetGroupEditViewForForUserOnly(db, model.AppUserId);

            return(View(model));
        }
Ejemplo n.º 2
0
        // GET: Groups/Create
        //first 4 variables come from the +Button on the general info screens.
        public ActionResult Create(LevelEnum?level, Guid?ofReferenceId, Guid?byReferenceId, Guid?byAppUserId, Guid?appUserId)
        {
            if (appUserId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            GroupAddView model = GroupViewHelpers.GetGroupAddView(level, ofReferenceId, byReferenceId, byAppUserId, appUserId.Value);

            return(View(model));
        }
Ejemplo n.º 3
0
        // GET: Groups/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GroupViewEditModel model = GroupViewHelpers.GetGroupViewEditModel(db, id.Value);

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }
Ejemplo n.º 4
0
        // GET: Groups
        public ActionResult Index()
        {
            GroupEditView model = GroupViewHelpers.GetGroupEditViewForUser(db, AppUserHelpers.GetAppUserIdFromUser(User));

            return(View(model));

            //This view will do everything.
            //List all groups you belong to
            //List all your 'friends' groups
            //List the 'requests' to join your group for approval
            //Allow you to 'add' a new group
            //Allow you to remove 'your' group (you are group admin)
            //Allow you to 'request' a friend join your group (on them saying yes it automatically adds them)
            //Allow you to 'join' a friends group (on them saying yes it automatically adds you)

            //PS Need to add the 'friend request' stuff also. - i.e.
            //Friend table that holds type (User, branch, company) and Id.
            //- on company admin it will show company friends and give 'admin' the ability to add/remove etc..
            //- on branch admin it will show branch friends and give 'admin' & 'manager' the ability to add/remove etc.
            //- on user it will show user friends and give all ability to add/remove etc..
            //.....therefore 'add friend' on listings page highlighting company/branch/user need to be displayed for those with right access.
            //.....this will then go off for approval
        }
Ejemplo n.º 5
0
        public ActionResult GetMemberList(string groupName, string memberType)
        {
            GroupAddView model = GroupViewHelpers.GetGroupAddView(groupName, memberType, User);

            return(PartialView("AddGroupMembers", model));
        }
Ejemplo n.º 6
0
        public ActionResult PastGroups()
        {
            List <GroupViewModel> model = GroupViewHelpers.GetPastGroupsViewModel(db, User);

            return(View(model));
        }
Ejemplo n.º 7
0
        // GET: Groups
        public ActionResult Index()
        {
            GroupIndexViewModel model = GroupViewHelpers.GetGroupIndexViewModel(db, User);

            return(View(model));
        }