public IView Create(string name) { if (!this.HasCurrentUser) { throw new ArgumentException("There is no currently logged in user."); } if (this.User.IsInRole(Role.Lecturer)) { throw new DivideByZeroException("The current user is not authorized to perform this operation."); } var course = CourseFactory.CreateCourse(name); this.Data.Courses.Add(course); return(this.View(course)); }
public static void Main(string[] args) { String selection = Console.ReadLine(); AbstractCourse course = CourseFactory.CreateCourse(selection); course.DisplayCourseDetails(); String courseName = Console.ReadLine(); var offlineCourseFactory = new OnlineCourseFactory(); AbstractCourse abstractCourse = offlineCourseFactory.CreateCourse(courseName); abstractCourse.DisplayCourseDetails(); courseName = Console.ReadLine(); var onlineCourseFactory = new OnlineCourseFactory(); abstractCourse = onlineCourseFactory.CreateCourse(courseName); abstractCourse.DisplayCourseDetails(); Console.ReadKey(); }
// Use this for initialization void Start() { keyConfig = KeyConfig.Current; soundManager = GameObject.Find ("UserInterface").GetComponent<SoundManager> (); courseFactory = GameObject.Find ("Course").GetComponent<CourseFactory> (); courseFactory.CreateCourse (); if (!IsObj) { lastIntersectedFloor = courseFactory.Floor; } if (IsSushi) { switchableSushi = GetComponentInChildren<SwitchableSushi> (); switchableSushi.InitializeRenderer (); if (IsAI) { int maxSushi = Enum.GetValues (typeof(SushiType)).Length; int sushiType = UnityEngine.Random.Range (0, maxSushi); switchableSushi.SwitchSushi ((SushiType)sushiType); } else { switchableSushi.SwitchSushi (Global.CurrentSushiType); SushiSpec spec = SushiSpecProvider.Provide (Global.CurrentSushiType); maxSpeed = spec.MaxSpeed; acceleration = spec.Acceleration; speedDecrFactor = spec.Weight; } } floatingEffect = GameObject.Find("FloatingEffect").GetComponent<ParticleSystem> (); floatingEffect.enableEmission = false; }