public override Boolean MoveNext() { if (_InternalEnumerator1 == null || _InternalEnumerator2 == null) { return(false); } if (_InternalEnumerator1.MoveNext()) { S p = _InternalEnumerator1.Current; if (_InternalEnumerator2.MoveNext()) { _CurrentElement = new ProjectsState(Conversor(p), _InternalEnumerator2.Current); } else { _CurrentElement = new ProjectsState(Conversor(p), false); } return(true); } return(false); }
public static ProjectsState ReduceDeleteProjectSuccessAction(ProjectsState state, DeleteProjectSuccessAction action) { // Return the default state if no list of projects is found if (state.CurrentProjects is null) { return(new ProjectsState(false, null, null, state.CurrentProject)); } // Create a new list with all project items excluding the project with the deleted ID var updatedProjects = state.CurrentProjects.Where(t => t.ProjectId != action.Id); return(new ProjectsState(false, null, updatedProjects, state.CurrentProject)); }
public static ProjectsState ReduceCreateProjectSuccessAction(ProjectsState state, CreateProjectSuccessAction action) { // Grab a reference to the current project list, or initialize one if we do not // currently have any loaded var currentProjects = state.CurrentProjects is null ? new List <ProjectViewDto>() : state.CurrentProjects.ToList(); // Add the newly created project to our list and sort by ID currentProjects.Add(action.ProjectView); currentProjects = currentProjects .OrderBy(t => t.ProjectId) .ToList(); return(new ProjectsState(false, null, currentProjects, state.CurrentProject)); }
public static ProjectsState ReduceUpdateProjectSuccessAction(ProjectsState state, UpdateProjectSuccessAction action) { // If the current projects list is null, set the state with a new list containing the // updated project if (state.CurrentProjects is null) { return(new ProjectsState(false, null, new List <ProjectViewDto> { action.ProjectView }, state.CurrentProject)); } // Rather than mutating in place, let's construct a new list and add our updated item var updatedList = state.CurrentProjects .Where(t => t.ProjectId != action.ProjectView.ProjectId) .ToList(); // Add the project and sort the list updatedList.Add(action.ProjectView); updatedList = updatedList .OrderBy(t => t.ProjectId) .ToList(); return(new ProjectsState(false, null, updatedList, null)); }
public static ProjectsState ReduceNavigationAction(ProjectsState state, GoAction _) => new ProjectsState(state.IsLoading, null, state.CurrentProjects, state.CurrentProject);
public static ProjectsState ReduceLoadProjectDetailAction(ProjectsState state, LoadProjectDetailAction _) => new ProjectsState(true, null, state.CurrentProjects, null);
public static ProjectsState ReduceLoadProjectDetailFailureAction(ProjectsState state, LoadProjectDetailFailureAction action) => new ProjectsState(false, action.ErrorMessage, state.CurrentProjects, null);
public static ProjectsState ReduceLoadProjectDetailSuccessAction(ProjectsState state, LoadProjectDetailSuccessAction action) => new ProjectsState(false, null, state.CurrentProjects, action.ProjectView);
public static ProjectsState ReduceUpdateProjectFailureAction(ProjectsState state, UpdateProjectFailureAction action) => new ProjectsState(false, action.ErrorMessage, state.CurrentProjects, state.CurrentProject);
public static ProjectsState ReduceUpdateProjectAction(ProjectsState state, UpdateProjectAction _) => new ProjectsState(true, null, state.CurrentProjects, state.CurrentProject);