Exemple #1
0
        /// <summary>
        /// Creates a mapping from user roles to the appropriate methods for getting scenarios
        /// </summary>
        /// <returns></returns>
        private Dictionary <string, SimulationGetMethod> CreateGetMethods()
        {
            List <SimulationModel> GetAllSimulations(UserInformationModel userInformation) =>
            repo.GetSimulations(db);
            List <SimulationModel> GetPermittedSimulations(UserInformationModel userInformation) =>
            repo.GetPermittedSimulations(db, userInformation.Name);

            return(new Dictionary <string, SimulationGetMethod>
            {
                [Role.ADMINISTRATOR] = GetAllSimulations,
                [Role.DISTRICT_ENGINEER] = GetAllSimulations,
                [Role.CWOPA] = GetAllSimulations,
                [Role.PLANNING_PARTNER] = GetAllSimulations
            });
        }
Exemple #2
0
 public IHttpActionResult GetSimulations() =>
 Ok(repo.GetSimulations(db));