Ejemplo n.º 1
0
        public IHttpActionResult AddMedicalNote([FromBody] MedicalNoteBasicDTO basicMedicalNoteInfo)
        {
            if (User.Identity.Name != basicMedicalNoteInfo.DoctorNIN && !User.IsInRole("Admin"))
            {
                return(new UnauthorizedWithHttpError(Request, ErrorCode.DoctorsCanOnlyAddMedicalNotesWithTheirNIN));
            }

            var medNoteWithSameMEN = medicalNoteService.GetMedicalNoteByMEN(basicMedicalNoteInfo.MEN);

            if (medNoteWithSameMEN != null)
            {
                return(new BadRequestWithHttpError(Request, ErrorCode.MedicalNoteAlreadyExistsWithThisMEN));
            }

            var doctorsService = new DoctorService();
            var doctor         = doctorsService.GetDoctorByNIN(basicMedicalNoteInfo.DoctorNIN);

            if (doctor == null)
            {
                return(new BadRequestWithHttpError(Request, ErrorCode.DoctorNotFoundWithThisNIN));
            }

            var studentService = new StudentService();
            var student        = studentService.GetStudentByNIN(basicMedicalNoteInfo.StudentNIN);

            if (student == null)
            {
                return(new BadRequestWithHttpError(Request, ErrorCode.StudentNotFoundWithThisNIN));
            }

            var institutionService = new InstitutionService();
            var institution        = institutionService.GetInstitutionByName(basicMedicalNoteInfo.InstitutionName);

            if (institution == null)
            {
                institutionService.AddInstitution(basicMedicalNoteInfo.InstitutionName);
            }

            institution = institutionService.GetInstitutionByName(basicMedicalNoteInfo.InstitutionName);

            if (institution == null)
            {
                return(InternalServerError());
            }

            var medicalNoteDTO = new MedicalNoteDTO()
            {
                DoctorID      = doctor.Id,
                StudentID     = student.Id,
                InstitutionID = institution.Id,
                Needs         = basicMedicalNoteInfo.Needs,
                MEN           = basicMedicalNoteInfo.MEN,
                // TODO : Change to custom date
                VisitDate = DateTime.Now,
                Diagnose  = basicMedicalNoteInfo.Diagnose
            };

            medicalNoteService.AddMedicalNote(medicalNoteDTO);
            return(Ok());
        }
Ejemplo n.º 2
0
        public IActionResult Institutions()
        {
            InstitutionService institutionService = new InstitutionService(Context);
            var model = institutionService.GetAll();

            return(View(model));
        }
Ejemplo n.º 3
0
 public AcademicsController(InfrastructureService infraService, StudentService studentService, InquiryService inquiryService, InstitutionService institutionService,
                            FeeService feeService, StudentProgramService studentprogramService)
 {
     this._infraService          = infraService;
     this._studentService        = studentService;
     this._inquiryService        = inquiryService;
     this._institutionService    = institutionService;
     this._feeService            = feeService;
     this._studentprogramService = studentprogramService;
 }
        public async void Get_CurrentCustomer(Customer customer)
        {
            string instanceName = Guid.NewGuid().ToString();

            using (var context = TestUtilities.GetDbContext(instanceName, customer.UserId)) {
                context.Customers.Add(customer);
                await context.SaveChangesAsync();
            }
            using (var context = TestUtilities.GetDbContext(instanceName, customer.UserId)) {
                InstitutionService   service = new InstitutionService(context, TestUtilities.GetMapper());
                InstitutionItemModel?result  = await service.GetInstitutionForCustomer <InstitutionItemModel>(customer.Id);

                Assert.NotNull(result);
            }
        }
Ejemplo n.º 5
0
 public PaymentController(RegisterUserService registerUserService, InstitutionService institutionService)
 {
     BuckarooClient      = new SdkClient();
     _registerUser       = registerUserService;
     _institutionService = institutionService;
 }
Ejemplo n.º 6
0
 protected override void OnInitialized()
 {
     editContext = new EditContext(Speaker);
     editContext.OnFieldChanged += HandleFieldChanged;
     institutions = InstitutionService.GetInstitutions().ToImmutableArray();
     if (Speaker.Institution is { })
Ejemplo n.º 7
0
 public SettingsController(InfrastructureService infraService, InstitutionService institutionService, SystemService systemService)
 {
     this._infraService       = infraService;
     this._institutionService = institutionService;
     this._systemService      = systemService;
 }
Ejemplo n.º 8
0
 public LoginController(FirebaseUtils firebaseUtils, InstitutionService institutionService, ClaimsUtils claimsUtils)
 {
     _firebaseUtils      = firebaseUtils;
     _institutionService = institutionService;
     _claimsUtils        = claimsUtils;
 }
Ejemplo n.º 9
0
 public UserController(IUserService userService, IRegisterUserService registerUserService, InstitutionService institutionService)
 {
     _userServcice        = userService;
     _registerUserService = registerUserService;
     _institutionService  = institutionService;
 }