예제 #1
0
 public PatientsController(AppDb newDb)
 {
     Db         = newDb;
     orgService = new OrganisationServices(Db);
     depService = new DepartmentServices(Db);
     patService = new PatientServices(Db);
 }
예제 #2
0
 public AppInfoController(AppDb newDb)
 {
     Db         = newDb;
     orgService = new OrganisationServices(Db);
     depService = new DepartmentServices(Db);
     patService = new PatientServices(Db);
     queueCalc  = new QueuePositionCalculator();
 }
예제 #3
0
        public IActionResult LogIn([FromBody] LoginRequest request)
        {
            OrganisationServices orgService = new OrganisationServices(Db);

            try {
                var org = orgService.FindByRegNrAndPassKey(request.registrationNr, request.passKey);
                if (org != null)
                {
                    return(Ok(orgService.RegisterNewLogin(org)));
                }
            } catch (MySqlException mySql) {
                System.Console.WriteLine("Developer Mode: " + mySql.Message);
                return(StatusCode(500, new GenericResponse("Error!", "Please contact the administration")));
            } catch (QueryFailedException update) {
                System.Console.WriteLine("Developer Mode: " + update.Message);
                return(BadRequest(new GenericResponse("Error!", "Please contact the administration")));
            }

            return(Unauthorized(new GenericResponse("Error!", "Invalid login credentials!")));
        }