public ActionResult KonsolDuzenle(Konsol t, HttpPostedFileBase file) { try { using (AdaGameContext context = new AdaGameContext()) { var _konsolDuzenle = context.Konsol.Where(x => x.ID == t.ID).FirstOrDefault(); if (file != null && file.ContentLength > 0) { MemoryStream memoryStream = file.InputStream as MemoryStream; if (memoryStream == null) { memoryStream = new MemoryStream(); file.InputStream.CopyTo(memoryStream); } _konsolDuzenle.KonsolFoto = memoryStream.ToArray(); } _konsolDuzenle.KonsolAdi = t.KonsolAdi; _konsolDuzenle.Fiyat = t.Fiyat; _konsolDuzenle.Tip = t.Tip; context.SaveChanges(); return(RedirectToAction("Konsol", "Admin")); } } catch (Exception ex) { throw new Exception("Güncellerken hata oluştu " + ex.Message); } }
public ActionResult KonsolEkle(Konsol t, HttpPostedFileBase file) { try { using (AdaGameContext context = new AdaGameContext()) { Konsol _konsol = new Konsol(); if (file != null && file.ContentLength > 0) { MemoryStream memoryStream = file.InputStream as MemoryStream; if (memoryStream == null) { memoryStream = new MemoryStream(); file.InputStream.CopyTo(memoryStream); } _konsol.KonsolFoto = memoryStream.ToArray(); } _konsol.KonsolAdi = t.KonsolAdi; _konsol.Fiyat = t.Fiyat; _konsol.Tip = t.Tip; context.Konsol.Add(_konsol); context.SaveChanges(); return(RedirectToAction("Konsol", "Admin")); } } catch (Exception ex) { throw new Exception("Eklerken hata oluştu"); } }
public ActionResult KonsolDetails(int KonsolID) { using (AdaGameContext context = new AdaGameContext()) { Konsol konsolDetails = context.Konsol.FirstOrDefault(x => x.ID == KonsolID); return(View(konsolDetails)); } }
public void Init() { _uut = new Konsol(); _writer = new StringWriter(); //Sets stdoutput for Console.WriteLine to Writer. Console.SetOut(_writer); // Fake Plane Creation //Plane 1 is still, Plane 2 is moving. _plane1 = Substitute.For <IPlane>(); _plane2 = Substitute.For <IPlane>(); _plane1.Tag.Returns("Test1"); _plane1.XCoordinate.Returns(10000); _plane1.YCoordinate.Returns(10000); _plane1.Altitude.Returns(10000); _plane1.LastUpdate.Returns(DateTime.Now); _plane2.Tag.Returns("Test2"); _plane2.XCoordinate.Returns(10000); _plane2.YCoordinate.Returns(10000); _plane2.Altitude.Returns(10000); _plane2.LastUpdate.Returns(DateTime.Now); _plane2.Speed.Returns(500.0); // <- Indicate plane is moving _planes = new List <IPlane> { _plane1, _plane2 }; List <IPlane> planePair = new List <IPlane> { _plane1, _plane2 }; _planesViolating = new List <List <IPlane> > { planePair }; }
private void Konsol_TextChanged(object sender, EventArgs e) { Konsol.ScrollBars = ScrollBars.Both; Konsol.SelectionStart = Konsol.Text.Length; Konsol.ScrollToCaret(); }