public async Task <MessageModel <DashboardPermissionsSaveModel> > DeleteUserDashboardPermissionAsync(DashboardPermissionsSaveModel model) { var newSaveItem = new DashboardPermissionsItemModel { Permission = model.RoleId, UserId = model.UserId }; var saveModel = await GetExistingDashboardPermissionItems(model); saveModel.Items = saveModel.Items.Where(i => i.UserId != newSaveItem.UserId).ToList(); return(await ApiClientFactory.Instance.AddUserDashBoardPermission(saveModel)); }
public async Task <MessageModel <DashboardPermissionsSaveModel> > AddOrUpdateUserDashboardPermissionAsync(DashboardPermissionsSaveModel model) { var newSaveItem = new DashboardPermissionsItemModel { Permission = model.RoleId, UserId = model.UserId }; var saveModel = await GetExistingDashboardPermissionItems(model); var ProvidedUserItem = saveModel.Items.FirstOrDefault(i => i.UserId == newSaveItem.UserId); if (ProvidedUserItem != null) { ProvidedUserItem.Permission = newSaveItem.Permission; } else { saveModel.Items.Add(newSaveItem); } return(await ApiClientFactory.Instance.AddUserDashBoardPermission(saveModel)); }