Example #1
0
        /// <summary>
        /// Creates a mapping from user roles to the appropriate methods for deleting scenarios
        /// </summary>
        /// <returns></returns>
        private Dictionary <string, SimulationDeletionMethod> CreateDeletionMethods()
        {
            void DeleteAnySimulation(int id, UserInformationModel userInformation) =>
            repo.DeleteAnySimulation(id, db);
            void DeletePermittedSimulation(int id, UserInformationModel userInformation) =>
            repo.DeletePermittedSimulation(id, db, userInformation.Name);

            return(new Dictionary <string, SimulationDeletionMethod>
            {
                [Role.ADMINISTRATOR] = DeleteAnySimulation,
                [Role.DISTRICT_ENGINEER] = DeletePermittedSimulation,
                [Role.CWOPA] = DeletePermittedSimulation,
                [Role.PLANNING_PARTNER] = DeletePermittedSimulation
            });
        }