// GET: UserBranch
        public ActionResult Index()
        {
            UserInBranchViewModel userInBranchVM = new UserInBranchViewModel();
            // List<SelectListItem> selectListItem = new List<SelectListItem>();
            // selectListItem = new List<SelectListItem>();
            List <PSAUserViewModel> PSAUserVMList = Mapper.Map <List <SAMTool.DataAccessObject.DTO.User>, List <PSAUserViewModel> >(_userBusiness.GetAllUsers());

            userInBranchVM.PSAUser = new PSAUserViewModel();
            userInBranchVM.PSAUser.UserSelectList = PSAUserVMList != null ? (from PSAuserVM in PSAUserVMList
                                                                             select new SelectListItem
            {
                Text = PSAuserVM.UserName,
                Value = PSAuserVM.ID.ToString(),
                Selected = false
            }).ToList() : new List <SelectListItem>();
            return(View(userInBranchVM));
        }
        public string InserUpdateUserInBranch(string userId, string hasAccess, string isDefault)
        {
            object result = null;

            try
            {
                UserInBranchViewModel userInBranchVM = new UserInBranchViewModel();
                userInBranchVM.UserID          = Guid.Parse(userId.ToString());
                userInBranchVM.DefaultBranch   = isDefault;
                userInBranchVM.HasAccessBranch = hasAccess;

                AppUA appUA = Session["AppUA"] as AppUA;
                userInBranchVM.PSASysCommon             = new PSASysCommonViewModel();
                userInBranchVM.PSASysCommon.CreatedBy   = appUA.UserName;
                userInBranchVM.PSASysCommon.CreatedDate = _pSASysCommon.GetCurrentDateTime();
                result = _userInBranchBusiness.InsertUpdateUserInBranch(Mapper.Map <UserInBranchViewModel, UserInBranch>(userInBranchVM));
                return(JsonConvert.SerializeObject(new { Status = "OK", Record = result, Message = "Success" }));
            }
            catch (Exception ex)
            {
                AppConstMessage cm = _appConstant.GetMessage(ex.Message);
                return(JsonConvert.SerializeObject(new { Status = "ERROR", Record = "", Message = cm.Message }));
            }
        }