public IActionResult GetAvailableDoctors([FromQuery] DateTime date) { var doctorDtos = DoctorMapper .ObjectToDto(doctorAvailabilityService.GetAvailableByDay(date)); return(Ok(doctorDtos)); }
public void Map_specialization_persistance_collection_to_specialization_entity_collection_when_collection_is_null() { List <DoctorPersistence> listOfdoctorPersistences = null; Assert.Throws <ArgumentNullException>(() => DoctorMapper.MapDoctorPersistenceCollectionToDoctorEntityCollection(listOfdoctorPersistences)); }
public void Map_doctor_persistance_to_doctor_entity_when_persistance_is_null() { DoctorPersistence doctorPersistance = null; Assert.Throws <ArgumentNullException>(() => DoctorMapper.MapDoctorPersistenceToDoctorEntity(doctorPersistance)); }
public IActionResult GetBySpecialization(int id) { List <Doctor> doctors = _doctorService.GetDoctorBySpecialization(id).ToList(); List <DoctorSearchDTO> doctorSearchList = DoctorMapper.ListDoctorToListDoctorSearchDTO(doctors); return(Ok(doctorSearchList)); }
public IActionResult GetAll() { List <Doctor> doctors = _doctorService.GetAll().ToList(); List <DoctorSearchDTO> doctorSearchList = DoctorMapper.ListDoctorToListDoctorSearchDTO(doctors); return(Ok(doctorSearchList)); }
public IEnumerable <Doctor> GetAllDoctors() { using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext)) { return(DoctorMapper.MapDoctorPersistenceCollectionToDoctorEntityCollection(_context.Doctors.ToList())); } }
public IEnumerable <Doctor> GetDoctorsPerSpecialization(Guid specializationId) { using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext)) { return(DoctorMapper.MapDoctorPersistenceCollectionToDoctorEntityCollection(_context.Doctors.Where(c => c.SpecializationId == specializationId).ToList())); } }
public void Map_doctor_entity_to_identifier_doctor_dto_when_when_entity_is_null() { Doctor doctor = null; Assert.Throws <ArgumentNullException>(() => DoctorMapper.MapDoctorEntityToIdentifierDoctorDTO(doctor)); }
public void Map_doctor_entities_collection_to_identifier_doctorDTO_collection_when_entities_collection_is_null() { List <Doctor> listOfDoctors = null; Assert.Throws <ArgumentNullException>(() => DoctorMapper.MapDoctorEntityCollectionToIdentifierDoctorDTOCollection(listOfDoctors)); }
public void TestUpdateDoctor() { IDataBaseService iDataBaseService = new DataBaseService(); DoctorService dService = new DoctorService(iDataBaseService); StaticDataServices staticDataService = new StaticDataServices(iDataBaseService); ILogger logger = new Logger(iDataBaseService); DataServices.DataServices dServ = new DataServices.DataServices(iDataBaseService); ViewModelFactory factory = new ViewModelFactory(dServ, staticDataService); DoctorMapper dMapper = new DoctorMapper(factory); DoctorController dController = new DoctorController(staticDataService, dServ, factory, dMapper, logger); dController.Request = new HttpRequestMessage { RequestUri = new Uri("http://localhost/Doctor/SaveDoctor") }; dController.Configuration = new HttpConfiguration(); dController.Configuration.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional }); dController.RequestContext.RouteData = new HttpRouteData( route: new HttpRoute(), values: new HttpRouteValueDictionary { { "controller", "doctor" } }); RequestCarrier req = new RequestCarrier(); req.From = "Test"; req.TanentId = -1; DoctorViewModel dvModel = new DoctorViewModel(staticDataService.GetCountry(), staticDataService.GetState(), staticDataService.GetCity(), staticDataService.GetHospital(), staticDataService.GetDegree(), staticDataService.GetSpecialization(), staticDataService.GetDesease()); dvModel.Id = 8; dvModel.Address1 = "12, DP Pharma Road"; dvModel.CityID = 1; dvModel.CreatedBy = 1; dvModel.CreatedByEntity = 1; dvModel.DoctorDegree = new List <int>(); dvModel.DoctorDesease = new List <int>(); dvModel.DoctorHospital = new List <int>(); dvModel.DoctorSpecialization = new List <int>(); dvModel.EmailAddress = "*****@*****.**"; dvModel.FirstName = "Raj"; dvModel.LastName = "Sharma"; dvModel.OtherInformation = "Heart Specilist"; dvModel.PhoneNumber = "8989889889"; dvModel.Pincode = "411014"; dvModel.ProfilePhotoID = 1; dvModel.RegistrationNumber = "RJ12123"; dvModel.TanentId = -1; //dvModel.UpdatedBy = 1; req.PayLoad = dvModel; var response = dController.SaveDoctor(req); Assert.IsNotNull(response); }
public void Map_doctor_entity_to_identifier_doctor_dto() { Doctor doctor = this.GetDoctorFirts(); IdentifiableDTO <DoctorDTO> identifierDoctorDTO = DoctorMapper.MapDoctorEntityToIdentifierDoctorDTO(doctor); Assert.True(IsEqualDoctorEntitiesAndIdentifierDoctorDTO(doctor, identifierDoctorDTO)); }
public MLStaticController(StaticDataServices staticDataServices, DataServices.DataServices dataServices, ViewModelFactory viewModelFactory, DoctorMapper doctorMapper, ILogger logger) { _staticDataServices = staticDataServices; _dataServices = dataServices; _viewModelFactory = viewModelFactory; _logger = logger; _doctorMapper = doctorMapper; }
public DoctorController(StaticDataServices staticDataServices, DataServices.DataServices dataServices, ViewModelFactory viewModelFactory, DoctorMapper doctorMapper, ILogger logger) { this._staticDataServices = staticDataServices; this._dataServices = dataServices; this._viewModelFactory = viewModelFactory; this._doctorMapper = doctorMapper; this._logger = logger; }
public void Map_doctor_persistence_to_doctor_entity() { DoctorPersistence doctorPersistance = this.GetDoctorPersistanceFirst(); Doctor doctorEntity = DoctorMapper.MapDoctorPersistenceToDoctorEntity(doctorPersistance); Assert.True(this.IsEqualDoctorPersistanceAndDoctorEntity(doctorPersistance, doctorEntity)); }
public Doctor GetDoctorById(Guid id) { using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext)) { var doctor = _context.Doctors.Include("Specialization").SingleOrDefault(c => c.Id.Equals(id)); return(DoctorMapper.MapDoctorPersistenceToDoctorEntity(doctor)); } }
public void Map_doctor_persistances_collection_to_doctor_entities_collection() { List <DoctorPersistence> listOfdoctorPersistences = this.GetListOfDoctorPersistance(); List <Doctor> listOfDoctorEntities = DoctorMapper.MapDoctorPersistenceCollectionToDoctorEntityCollection(listOfdoctorPersistences).ToList(); Assert.True(this.IsEqualDoctorPersistanceAndDoctorEntity(listOfdoctorPersistences[0], listOfDoctorEntities[0])); Assert.True(this.IsEqualDoctorPersistanceAndDoctorEntity(listOfdoctorPersistences[1], listOfDoctorEntities[1])); }
public void Map_doctor_entites_collection_to_identifier_doctorDTO_collection() { List <Doctor> listOfdoctors = this.GetListOfDoctors(); List <IdentifiableDTO <DoctorDTO> > listOfIdentifierDoctorDTO = DoctorMapper.MapDoctorEntityCollectionToIdentifierDoctorDTOCollection(listOfdoctors).ToList(); Assert.True(this.IsEqualDoctorEntitiesAndIdentifierDoctorDTO(listOfdoctors[0], listOfIdentifierDoctorDTO[0])); Assert.True(this.IsEqualDoctorEntitiesAndIdentifierDoctorDTO(listOfdoctors[1], listOfIdentifierDoctorDTO[1])); }
public void TestSaveUser() { IDataBaseService iDataBaseService = new DataBaseService(); UserService uService = new UserService(iDataBaseService); StaticDataServices staticDataService = new StaticDataServices(iDataBaseService); ILogger logger = new Logger(iDataBaseService); DataServices.DataServices dServ = new DataServices.DataServices(iDataBaseService); ViewModelFactory factory = new ViewModelFactory(dServ, staticDataService); UserMapper uMapper = new UserMapper(factory); OtpMapper oMapper = new OtpMapper(factory); DoctorMapper doctorMapper = new DoctorMapper(factory); UserController uController = new UserController(staticDataService, dServ, factory, uMapper, doctorMapper, oMapper, logger); uController.Request = new HttpRequestMessage { RequestUri = new Uri("http://localhost/User/SaveUser") }; uController.Configuration = new HttpConfiguration(); uController.Configuration.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional }); uController.RequestContext.RouteData = new HttpRouteData( route: new HttpRoute(), values: new HttpRouteValueDictionary { { "controller", "user" } }); RequestCarrier req = new RequestCarrier(); req.From = "Test"; req.TanentId = -1; UserViewModel dvModel = new UserViewModel(staticDataService.GetCountry(), staticDataService.GetState(), staticDataService.GetCity()); dvModel.Id = 6; dvModel.Email = "*****@*****.**"; dvModel.Password = "******"; dvModel.FirstName = "Shubham"; dvModel.LastName = "Joshi"; dvModel.CreatedByEntity = 1; dvModel.PhoneNumber = "8968574635"; dvModel.IsPhoneNoVerified = false; dvModel.IsDeleted = false; dvModel.TanentId = -1; dvModel.CreatedBy = 1; //dvModel.UpdatedBy = 1; req.PayLoad = dvModel; var response = uController.SaveUser(req); Assert.IsNotNull(response); }
public IActionResult GetBySpecialty(int specialtyId) { if (specialtyId <= 0) { return(BadRequest("Bad specialty.")); } var doctors = _doctorService.GetBySpecialty(specialtyId); var doctorDtoList = DoctorMapper.ObjectToDto(doctors); doctorDtoList.ToList().ForEach(dto => dto.SpecialtyId = specialtyId); return(Ok(doctorDtoList)); }
public IEnumerable <IdentifiableDTO <DoctorDTO> > GetDoctorsPerSpecialization(Guid specializationId) { try { return(DoctorMapper.MapDoctorEntityCollectionToIdentifierDoctorDTOCollection(_doctorRepository.GetDoctorsPerSpecialization(specializationId))); }catch (ArgumentNullException e) { throw new NotFoundEntityException(); }catch (Exception e) { throw new InternalServerErrorException(); } }
public IdentifiableDTO <DoctorDTO> GetById(Guid id) { try { return(DoctorMapper.MapDoctorEntityToIdentifierDoctorDTO(_doctorRepository.GetById(id))); }catch (ArgumentNullException e) { throw new NotFoundEntityException(); }catch (Exception e) { throw new InternalServerErrorException(); } }
public ActionResult GetAllDoctors() { List <DoctorDTO> doctorDTOs = new List <DoctorDTO>(); try { _doctorService.ViewDoctors().ForEach(doctor => doctorDTOs.Add(DoctorMapper.DoctorToDoctorDTO(doctor))); return(Ok(doctorDTOs)); } catch (NotFoundException exception) { return(NotFound(exception.Message)); } }
public IEnumerable <IdentifiableDTO <DoctorDTO> > GetAll() { try { return(_doctorRepository.GetAll().Select(c => DoctorMapper.MapDoctorEntityToIdentifierDoctorDTO(c))); } catch (ArgumentNullException e) { throw new NotFoundEntityException(); } catch (Exception e) { throw new InternalServerErrorException(); } }
public IActionResult GetDoctorByJmbg(string jmbg) { try { Doctor doctor = _doctorService.GetDoctorByJmbg(jmbg); return(Ok(DoctorMapper.DoctorToDoctorDTO(doctor))); } catch (DatabaseException e) { return(StatusCode(500, e.Message)); } catch (NotFoundException e) { return(NotFound(e.Message)); } }
public IActionResult GetDoctorsBySpecialtyId(int id) { List <DoctorDTO> doctorDTOs = new List <DoctorDTO>(); try { foreach (Doctor doctor in _doctorService.ViewDoctorsBySpecialty(id)) { doctorDTOs.Add(DoctorMapper.DoctorToDoctorDTO(doctor)); } return(Ok(doctorDTOs)); } catch (DatabaseException e) { return(StatusCode(500, e.Message)); } }
public void TestGetUser() { IDataBaseService iDataBaseService = new DataBaseService(); UserService uService = new UserService(iDataBaseService); StaticDataServices staticDataService = new StaticDataServices(iDataBaseService); ILogger logger = new Logger(iDataBaseService); DataServices.DataServices dServ = new DataServices.DataServices(iDataBaseService); ViewModelFactory factory = new ViewModelFactory(dServ, staticDataService); UserMapper uMapper = new UserMapper(factory); OtpMapper oMapper = new OtpMapper(factory); DoctorMapper doctorMapper = new DoctorMapper(factory); UserController uController = new UserController(staticDataService, dServ, factory, uMapper, doctorMapper, oMapper, logger); uController.Request = new HttpRequestMessage { RequestUri = new Uri("http://localhost/User/GetUser") }; uController.Configuration = new HttpConfiguration(); uController.Configuration.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional }); uController.RequestContext.RouteData = new HttpRouteData( route: new HttpRoute(), values: new HttpRouteValueDictionary { { "controller", "user" } }); RequestCarrier req = new RequestCarrier(); req.From = "Test"; req.TanentId = -1; UserViewModel uvModel = new UserViewModel(staticDataService.GetCountry(), staticDataService.GetState(), staticDataService.GetCity()); uvModel.Id = 3; req.PayLoad = uvModel; var response = uController.GetUser(req); }
public void TestGetDoctor() { IDataBaseService iDataBaseService = new DataBaseService(); DoctorService dService = new DoctorService(iDataBaseService); StaticDataServices staticDataService = new StaticDataServices(iDataBaseService); ILogger logger = new Logger(iDataBaseService); DataServices.DataServices dServ = new DataServices.DataServices(iDataBaseService); ViewModelFactory factory = new ViewModelFactory(dServ, staticDataService); DoctorMapper dMapper = new DoctorMapper(factory); DoctorController dController = new DoctorController(staticDataService, dServ, factory, dMapper, logger); dController.Request = new HttpRequestMessage { RequestUri = new Uri("http://localhost/Doctor/GetDoctor") }; dController.Configuration = new HttpConfiguration(); dController.Configuration.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional }); dController.RequestContext.RouteData = new HttpRouteData( route: new HttpRoute(), values: new HttpRouteValueDictionary { { "controller", "doctor" } }); RequestCarrier req = new RequestCarrier(); req.From = "Test"; req.TanentId = -1; DoctorViewModel dvModel = new DoctorViewModel(staticDataService.GetCountry(), staticDataService.GetState(), staticDataService.GetCity(), staticDataService.GetHospital(), staticDataService.GetDegree(), staticDataService.GetSpecialization(), staticDataService.GetDesease()); dvModel.Id = 8; req.PayLoad = dvModel; var response = dController.GetDoctor(req); }
[HttpGet("getAllDoctorBySpecializationId/{specializationId}")] // GET /api/doctor/getAllDoctorBySpecializationId/{specializationId} public IActionResult GetAllDoctorsBySpecializationId(int specializationId) { List <DoctorDto> result = new List <DoctorDto>(); App.Instance().DoctorService.GetAllDoctorsBySpecialization(specializationId).ToList().ForEach(doctor => result.Add(DoctorMapper.DoctorToDoctorDto(doctor))); return(Ok(result)); }
public DoctorService() { repository = DoctorRepository.GetInstance(); doctorMapper = new DoctorMapper(); }