private static void Switch(string[] args) { switch (args[0].ToLower()) { case "bind": Binder.Bind(GetArgs <BindOptions>(args)); break; case "convert": ProfileConverter.WriteProfiles(GetArgs <CommandLineOptions>(args)); break; case "bake": ProfileBakery.Bake(GetArgs <BakeryOptions>(args)); break; case "clean": Directory.GetFiles(args[1], "*.gen.cs", SearchOption.AllDirectories).ForEach(File.Delete); break; default: PipelineFile(args); break; } }
public void Init() { profileConverter = new ProfileConverter(); profileMock = new Profile { AccessToken = "AccessToken", Id = 1, ExternalId = 1, SourceId = 1, Url = "Url", UserId = 1 }; userMock = new UserRegisterModel { ExternalId = 1, AccessToken = "AccessToken" }; profileRepositoryMock = new Mock <IRepository <Profile> >(); unitOfWorkMock = new Mock <IUnitOfWork>(); profileRepositoryMock .Setup(profileRepository => profileRepository.GetSingleOrDefaultAsync(It.IsAny <Expression <Func <Profile, bool> > >())) .ReturnsAsync(profileMock); profileRepositoryMock .Setup(profileRepository => profileRepository.GetByIdAsync(It.IsAny <int>())) .ReturnsAsync(profileMock); unitOfWorkMock .Setup(profileRepository => profileRepository.GetRepository <Profile>()) .Returns(profileRepositoryMock.Object); profileService = new ProfileService(unitOfWorkMock.Object, profileConverter); }
public HttpResponseMessage Get(string userName) { var profile = new Facade().GetProfileRepository().Get(userName); ProfileDTO profileDTO = null; profileDTO = new ProfileConverter().Convert(profile); return Request.CreateResponse<ProfileDTO>(HttpStatusCode.OK, profileDTO); }
private ProfileResult Convert(Requirement project, string indexId) { var profileListView = mapper.Map <Requirement, ProfileListView>(project); var profileConverter = new ProfileConverter(profileListView, indexId); var projectProfileResult = profileConverter.Convert(); return(projectProfileResult); }
private static ClassInformation FromDatabase(CourseClass courseClass) { ProfileConverter profileConverter = new ProfileConverter(); TimetableUnitConverter timetableConverter = new TimetableUnitConverter(); return(new ClassInformation() { ClassCode = courseClass.CourseClassCode, CourseName = courseClass.Course.CourseName, CreditCount = courseClass.Course.CreditCount, Students = courseClass.Registration.Select(r => new ViewModels.Student(profileConverter.ForwardConverter(r.Student))).ToList(), Times = courseClass.Timetable.Select(t => timetableConverter.ForwardConverter(t)).ToList() }); }
/// <summary> /// Will get a specific Profile found by the Id /// </summary> /// <param name="id"></param> /// <returns></returns> public HttpResponseMessage Get(int id) { var profile = new Facade().GetProfileRepository().Get(id); ProfileDTO profileDTO = null; if (profile != null) { profileDTO = new ProfileConverter().Convert(profile); return Request.CreateResponse<ProfileDTO>(HttpStatusCode.OK, profileDTO); } var response = new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent("Profile not found.") }; throw new HttpResponseException(response); }
private static void Switch(string[] args) { switch (args[0].ToLower()) { case "bind": Binder.Bind(GetArgs <BindOptions>(args)); break; case "convert": ProfileConverter.WriteProfiles(GetArgs <CommandLineOptions>(args)); break; case "bake": ProfileBakery.Bake(GetArgs <BakeryOptions>(args)); break; default: PipelineFile(args); break; } }
public ControlPageViewModel() { FlowProfileNames = new ObservableCollection <string> { "Sine", "Square", "Triangle", "Peaks", "Custom" }; TrackedFlowPoints = new ObservableCollection <PointTracker>(); ControlFlowPoints = new ObservableCollection <DataPoint>(); IdealIntegral = new ObservableCollection <DataPoint>(); LogFlowPoints = new ObservableCollection <DataPoint>(); LogVolumePoints = new ObservableCollection <DataPoint>(); //Recorded Collections LogLinearPoints = new ObservableCollection <DataPoint>(); LogSensorPoints = new ObservableCollection <DataPoint>(); LogTargetPoints = new ObservableCollection <DataPoint>(); LogVelocityPoints = new ObservableCollection <DataPoint>(); LogPressurePoints = new ObservableCollection <DataPoint>(); Amplitude = 20; Frequency = 3; SamplingInterval = 0.04; Repeat = 1; RecordedProfile = ""; RecordedDateTime = ""; RecordedMaxTime = 0; RecordedMinFlow = 0; RecordedMaxFlow = 0; RecordedMinVolume = 0; RecordedMaxVolume = 0; ProfileConverter = new ProfileConverter(); USBConnected = false; PortName = "COM5"; }
public ProfileService(IUnitOfWork unitOfWork, ProfileConverter profileConverter) { this.unitOfWork = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork)); this.profileConverter = profileConverter ?? throw new ArgumentNullException(nameof(profileConverter)); }
public ProfileService(IDALFacade dalFacade) { _facade = dalFacade; _converter = new ProfileConverter(); }
/// <summary> /// Creates a Profile in the Database /// </summary> /// <param name="profile"></param> /// <returns></returns> public HttpResponseMessage Post(Profile profile) { try { var profileDTO = new ProfileConverter().Convert(profile); facade.GetProfileRepository().Add(profile); var response = Request.CreateResponse<ProfileDTO>(HttpStatusCode.Created, profileDTO); var uri = Url.Link("GetProfileById", new { profile.Id }); response.Headers.Location = new Uri(uri); return response; } catch (Exception) { var response = new HttpResponseMessage(HttpStatusCode.Conflict) { Content = new StringContent("Could not add a profile to the database") }; throw new HttpResponseException(response); } }