public static void IMPAbstractFactory() { //Google IMobilePhone googleMobilePhone = new Google(); MobileClient googleClient = new MobileClient(googleMobilePhone); Console.WriteLine("******* Google **********"); Console.WriteLine(googleClient.GetSmartPhoneModelDetails()); Console.WriteLine(googleClient.GetNormalPhoneModelDetails()); //NOKIA IMobilePhone nokiaMobilePhone = new Nokia(); MobileClient nokiaClient = new MobileClient(nokiaMobilePhone); Console.WriteLine("********* NOKIA **********"); Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails()); Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails()); //SAMSUNG IMobilePhone samsungMobilePhone = new Samsung(); MobileClient samsungClient = new MobileClient(samsungMobilePhone); Console.WriteLine("******* SAMSUNG **********"); Console.WriteLine(samsungClient.GetSmartPhoneModelDetails()); Console.WriteLine(samsungClient.GetNormalPhoneModelDetails()); }
public async Task <IActionResult> Edit(int id, [Bind("SamsungId,imageName,SamsungAciklama,SamsungFiyat")] Samsung samsung) { if (id != samsung.SamsungId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(samsung); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SamsungExists(samsung.SamsungId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(samsung)); }
public ActionResult DeleteConfirmed(int id) { Samsung samsung = db.Samsungs.Find(id); db.Samsungs.Remove(samsung); db.SaveChanges(); return(RedirectToAction("Index")); }
static void Main(string[] args) { #region Example01 Console.WriteLine("********* Example01 **********"); ContinentFactory africa = new AfricaFactory(); AnimalWorld world = new AnimalWorld(africa); world.RunFoodChain(); ContinentFactory america = new AmericaFactory(); world = new AnimalWorld(america); world.RunFoodChain(); #endregion Console.WriteLine(""); #region Example02 Console.WriteLine("********* Example02 **********"); IMobilePhone nokiaMobilePhone = new Nokia(); MobileClient nokiaClient = new MobileClient(nokiaMobilePhone); Console.WriteLine("********* NOKIA **********"); Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails()); Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails()); IMobilePhone samsungMobilePhone = new Samsung(); MobileClient samsungClient = new MobileClient(samsungMobilePhone); Console.WriteLine("******* SAMSUNG **********"); Console.WriteLine(samsungClient.GetSmartPhoneModelDetails()); Console.WriteLine(samsungClient.GetNormalPhoneModelDetails()); #endregion Console.WriteLine(""); #region Example03 Console.WriteLine("********* Example03 **********"); Document[] documents = new Document[2]; documents[0] = new Resume(); documents[1] = new Report(); // Display document pages foreach (Document document in documents) { Console.WriteLine("\n" + document.GetType().Name + "--"); foreach (Page page in document.Pages) { Console.WriteLine(" " + page.GetType().Name); } } #endregion Console.ReadKey(); }
// GET: /Action/GoSmart public ActionResult GoSmart() { Screen.EnsureScreenOn(false); Running.StartStream("SmartTv"); Screen.WaitForScreenOn(); Receiver.SelectTvInput(); Receiver.SelectTVOutput(); Samsung.SendKey("CONTENTS"); return(Content("")); }
static void Main(string[] args) { Iphone iphone = new Iphone(); iphone.Fiyat(); Samsung samsung = new Samsung(); samsung.Fiyat(); }
public ActionResult Edit([Bind(Include = "phones,Galaxy1,Galaxy2,Galaxy3")] Samsung samsung) { if (ModelState.IsValid) { db.Entry(samsung).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(samsung)); }
static void Main(string[] args) { AppleStore appleStore = new AppleStore(); Samsung samsung = new Samsung(); appleStore.Catalog(); samsung.Catalog(); Console.Read(); }
public async Task <IActionResult> Create([Bind("SamsungId,Name,Model,Year")] Samsung samsung) { if (ModelState.IsValid) { _context.Add(samsung); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(samsung)); }
public ActionResult Create([Bind(Include = "phones,Galaxy1,Galaxy2,Galaxy3")] Samsung samsung) { if (ModelState.IsValid) { db.Samsungs.Add(samsung); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(samsung)); }
public void SamsungPhoneTest() { IMobilePhone SamsungMobilePhone = new Samsung(); MobileClient SamsungClient = new MobileClient(SamsungMobilePhone); var descriptionNormalPhone = SamsungClient.GetNormalPhoneModelDetails(); var descriptionSmartPhone = SamsungClient.GetSmartPhoneModelDetails(); descriptionNormalPhone.Equals(Description.SamsungGuru).Should().BeTrue(); descriptionSmartPhone.Equals(Description.SamsungGalaxy).Should().BeTrue(); }
static void Main(string[] args) { #region 01 Creation Patterns #region 01 Abstract Factory //ISmartPhone smartPhone; //INormalPhone normalPhone; IMobilePhone nokiaPhone = new Nokia(); Console.WriteLine(nokiaPhone.GetNormalPhone().GetModelDetials()); Console.WriteLine(nokiaPhone.GetSmartPhone().GetModelDetials()); IMobilePhone samsungPhone = new Samsung(); Console.WriteLine(samsungPhone.GetNormalPhone().GetModelDetials()); Console.WriteLine(samsungPhone.GetSmartPhone().GetModelDetials()); #endregion #region 02 Factory Method //Document[] documents = new Document[2]; var documents = new List <Document>(); documents.Add(new Resume()); documents.Add(new Report()); foreach (var item in documents) { Console.WriteLine("-" + item.GetType().Name); foreach (var page in item.Pages) { Console.WriteLine(" -" + page.GetType().Name); } } #endregion #endregion #region 02 Structural Patterns #region 07 Proxy IMath proxy = new MathProxy(); Console.WriteLine("4 + 2 = " + proxy.Add(4, 2)); Console.WriteLine("4 - 2 = " + proxy.Sub(4, 2)); Console.WriteLine("4 * 2 = " + proxy.Mul(4, 2)); Console.WriteLine("4 / 2 = " + proxy.Div(4, 2)); #endregion #endregion #region 03 Behavioral Patterns #endregion FinishProgram(); }
static void Main(string[] args) { Smartphone smartphone; smartphone = new xiaomi(); smartphone.Beroperasi(); Console.WriteLine(); smartphone = new Samsung(); smartphone.Beroperasi(); Console.ReadKey(); }
static void Main(string[] args) { ISmartphone ismartphone; ismartphone = new Iphone(); ismartphone.Merk(); Console.WriteLine(); ismartphone = new Samsung(); ismartphone.Merk(); Console.ReadKey(); }
static void Main(string[] args) { //Abstract Factorys. var nokiaFactory = new Nokia(); var samsungFactory = new Samsung(); var nokiaClient = new MobileClient(nokiaFactory); var samsungClient = new MobileClient(samsungFactory); Console.WriteLine(samsungClient.GetSmartPhoneModelDetails()); Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails()); Console.ReadLine(); }
public static Samsung CreateJ5Samsung(string countryOrigin) { var samsungJ5 = new Samsung() { Battery = "3000 mAh", Camera = "13px", Display = "fewfew", OperatingSystem = "Android", CountryOrigin = countryOrigin }; return(samsungJ5); }
public TV BuildTV(Brands thisKind) { TV newSet; switch (thisKind) { case Brands.Samsung : Samsung aSamsungTV = new Samsung(); aSamsungTV.BacklightIntensity = double.MinVal; aSamsungTV.AutoShutdownTime = 45; //oops! I made a magic number. My bad newSet = aSamsungTV; SetAutoShutDownTime = new delegate (newSet.SetASDT); break; . . . } // switch }
// GET: Samsungs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Samsung samsung = db.Samsungs.Find(id); if (samsung == null) { return(HttpNotFound()); } return(View(samsung)); }
static void InheritanceExample1() { Samsung samsung = new Samsung(); samsung.Display(); samsung.Manufacturer = "Samsung"; samsung.Model = "S8"; samsung.OperatingSystem = "Oreo"; samsung.ScreenSize = 6.2; samsung.RezolutionHeight = 2960; samsung.RezolutionWidth = 1440; samsung.Display(); Console.ReadKey(); }
static void Main(string[] args) { IMobilePhone nokiaMobilePhone = new Nokia(); MobileClient nokiaClient = new MobileClient(nokiaMobilePhone); Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails()); Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails()); IMobilePhone samsungMobilePhone = new Samsung(); MobileClient samsungClient = new MobileClient(samsungMobilePhone); Console.WriteLine(samsungClient.GetSmartPhoneModelDetails()); Console.WriteLine(samsungClient.GetNormalPhoneModelDetails()); Console.Read(); }
static void Main(string[] args) { Iphone iphone = new Iphone(); iphone.Fiyat = 4000; iphone.Bilgiler(); Console.WriteLine("----"); Samsung samsung = new Samsung(); samsung.Fiyat = 2000; samsung.Bilgiler(); Console.ReadLine(); }
public static void AbstractFactory() { IMobilePhone nokiaMobilePhone = new Nokia(); MobileClient nokiaClient = new MobileClient(nokiaMobilePhone); Console.WriteLine("********* NOKIA **********"); Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails()); Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails()); IMobilePhone samsungMobilePhone = new Samsung(); MobileClient samsungClient = new MobileClient(samsungMobilePhone); Console.WriteLine("******* SAMSUNG **********"); Console.WriteLine(samsungClient.GetSmartPhoneModelDetails()); Console.WriteLine(samsungClient.GetNormalPhoneModelDetails()); }
static void Main(string[] args) { //AbtractionClass //Handphone handphone; //Console.WriteLine(); //handphone = new Samsung(); //handphone.Buatan(); //Console.WriteLine(); //handphone = new Vivo(); //handphone.Buatan(); //Console.WriteLine(); //handphone = new Xiaomi(); //handphone.Buatan(); //Interface IHandphone handphone; ILokasi lokasi; handphone = new Samsung(); handphone.Buatan(); lokasi = new Samsung(); lokasi.Kota(); Console.WriteLine(); handphone = new Vivo(); handphone.Buatan(); lokasi = new Vivo(); lokasi.Kota(); Console.WriteLine(); handphone = new Xiaomi(); handphone.Buatan(); lokasi = new Xiaomi(); lokasi.Kota(); Console.ReadKey(); }
public static string MainFn() { string result = string.Empty; IMobilePhone nokiaMobilePhone = new Nokia(); MobileClient nokiaClient = new MobileClient(nokiaMobilePhone); result += nokiaClient.GetSmartPhoneModelDetails(); result += nokiaClient.GetNormalPhoneModelDetails(); IMobilePhone samsungMobilePhone = new Samsung(); MobileClient samsungClient = new MobileClient(samsungMobilePhone); result += samsungClient.GetSmartPhoneModelDetails(); result += samsungClient.GetNormalPhoneModelDetails(); return(result); }
private static void GetAbstractFactoryPattern() { ImobilePhone nokiaMobilePhone = new Nokia(); MobileClient nokiaClient = new MobileClient(nokiaMobilePhone); Console.WriteLine("********* NOKIA **********"); Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails()); Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails()); ImobilePhone samsungMobilePhone = new Samsung(); MobileClient samsungClient = new MobileClient(samsungMobilePhone); Console.WriteLine("******* SAMSUNG **********"); Console.WriteLine(samsungClient.GetSmartPhoneModelDetails()); Console.WriteLine(samsungClient.GetNormalPhoneModelDetails()); Console.ReadKey(); }
private static void Main() { IMobilePhone nokiaMobilePhone = new Nokia(); var nokiaClient = new MobileClient(nokiaMobilePhone); Console.WriteLine("********* NOKIA **********"); Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails()); Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails()); IMobilePhone samsungMobilePhone = new Samsung(); var samsungClient = new MobileClient(samsungMobilePhone); Console.WriteLine("******* SAMSUNG **********"); Console.WriteLine(samsungClient.GetSmartPhoneModelDetails()); Console.WriteLine(samsungClient.GetNormalPhoneModelDetails()); Console.ReadKey(); }
static void Main(string[] args) { ITelemovel nokiaTelemovel = new Nokia(); TelemovelClient nokiaClient = new TelemovelClient(nokiaTelemovel); Console.WriteLine("*************** NOKIA ***************"); Console.WriteLine(nokiaClient.BuscarSmartPhoneModeloDetalhes()); Console.WriteLine(nokiaClient.BuscarNormalPhoneModeloDetalhes()); ITelemovel samsungTelemovel = new Samsung(); TelemovelClient samsungClient = new TelemovelClient(samsungTelemovel); Console.WriteLine("*************** SAMSUNG ***************"); Console.WriteLine(samsungClient.BuscarSmartPhoneModeloDetalhes()); Console.WriteLine(samsungClient.BuscarNormalPhoneModeloDetalhes()); Console.ReadKey(); }
static void Main(string[] args) { IObserverUser mehmet = new ObserverUser(); IObserverUser derya = new ObserverUser(); IObserverUser sema = new ObserverUser(); IObserverUser aleyna = new ObserverUser(); // İzlenecek olan sınıf örneği. Samsung samsung = new Samsung(); // İzlenecek olan sınıfa etkilenecek olan nesnelerin atanması. samsung.AddObserver(mehmet); samsung.AddObserver(derya); samsung.AddObserver(sema); samsung.AddObserver(aleyna); samsung.ChangePrice(); }
static void Main(string[] args) { Director director = new Director(); Samsung samsung = new Samsung(); director.Builder = samsung; Console.WriteLine("Basic samsung complectation:\n"); director.Basic(); Console.WriteLine(samsung.GetComplectation().ListParts()); Console.WriteLine("Standard samsung complectation:\n"); director.Standart(); Console.WriteLine(samsung.GetComplectation().ListParts()); Console.WriteLine("Lux samsung complectation:\n"); director.Lux(); Console.WriteLine(samsung.GetComplectation().ListParts()); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-\n"); Nokia nokia = new Nokia(); director.Builder = nokia; Console.WriteLine("Basic nokia complectation:\n"); director.Basic(); Console.WriteLine(nokia.GetComplectation().ListParts()); Console.WriteLine("Standard nokia complectation:\n"); director.Standart(); Console.WriteLine(nokia.GetComplectation().ListParts()); Console.WriteLine("Lux nokia complectation:\n"); director.Lux(); Console.WriteLine(nokia.GetComplectation().ListParts()); Console.ReadLine(); }
private static void Observer() { // Güncellemeden etkilenecek olan sınıf örnekleri. IObserverUser mehmet = new ObserverUser(); IObserverUser derya = new ObserverUser(); IObserverUser sema = new ObserverUser(); IObserverUser aleyna = new ObserverUser(); // İzlenecek olan sınıf örneği. Samsung samsung = new Samsung(); // İzlenecek olan sınıfa etkilenecek olan nesnelerin atanması. samsung.AddObserver(mehmet); samsung.AddObserver(derya); samsung.AddObserver(sema); samsung.AddObserver(aleyna); samsung.ChangePrice(); }
public void TVAdded(ref Samsung.iRemoteWrapper.TVInfo info) { comboBoxTV.Items.Add(info); String tv = comboBoxTV.Items[0].ToString(); using (Settings reader = new MPSettings()) { tv = reader.GetValueAsString("Auto3DPlugin", "SamsungAddress", info.ToString()); } foreach (Samsung.iRemoteWrapper.TVInfo item in comboBoxTV.Items) { if (item.ToString() == info.ToString()) { comboBoxTV.SelectedItem = item; break; } } comboBoxTV.SelectedItem = info; }
public void TVRemoved(ref Samsung.iRemoteWrapper.TVInfo info) { int i = comboBoxTV.FindStringExact(info.ToString()); if (i > 0) comboBoxTV.Items.RemoveAt(i); }