Example #1
0
        public async Task <ActionResult> AddUserName(string data, string fieldPrefix, string newUser)
        {
            using (UserDefinitionDataProvider userDP = new DataProvider.UserDefinitionDataProvider()) {
                UserDefinition user = await userDP.GetItemAsync(newUser);

                if (user == null)
                {
                    throw new Error(this.__ResStr("noUser", "User {0} not found", newUser));
                }
                List <ListOfUserNamesEditComponent.Entry> list = Utility.JsonDeserialize <List <ListOfUserNamesEditComponent.Entry> >(data);
                if ((from l in list where l.UserId == user.UserId select l).FirstOrDefault() != null)
                {
                    throw new Error(this.__ResStr("dupUser", "User {0} has already been added", newUser));
                }
                ListOfUserNamesEditComponent.Entry entry = new ListOfUserNamesEditComponent.Entry {
                    UserName = newUser,
                    UserId   = user.UserId,
                };
                return(await GridRecordViewAsync(await ListOfUserNamesEditComponent.GridRecordAsync(fieldPrefix, entry)));
            }
        }
Example #2
0
 public async Task <ActionResult> ListOfUserNamesBrowse_GridData(GridPartialViewData gridPVData)
 {
     return(await GridPartialViewAsync(ListOfUserNamesEditComponent.GetGridAllUsersModel(), gridPVData));
 }
Example #3
0
 public async Task <ActionResult> ListOfUserNamesEdit_SortFilter(GridPartialViewData gridPVData)
 {
     return(await GridPartialViewAsync <ListOfUserNamesEditComponent.Entry>(ListOfUserNamesEditComponent.GetGridModel(false), gridPVData));
 }